gculbert70 0 Posted January 4, 2013 Report 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. Quote Link to post Share on other sites
boen_robot 107 Posted January 5, 2013 Report 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 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.