gculbert70 Posted January 4, 2013 Share Posted January 4, 2013 What is the best way to add a count node to an XSLT template so it increments on every record I transform? So if I pull in a XML with 5 records everything it transforms a record it increments by 1. Link to comment Share on other sites More sharing options...
boen_robot Posted January 5, 2013 Share Posted January 5, 2013 You may be thinking of this the wrong way.You can use the XPath count() function to get the total number of nodes in a node set, and you can do so separately from the whole processing. Within processing, you can use position() to get the posistion of a node within a node set, which is sure to increment on each iteration of that node set.The only case where this is not enough would be in a recursive template. In that case, you can add a parameter to the template that defaults to 1. Increment that counter upon making the recursive call. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now