Jump to content

Adding a Count Node to a XSLT Template


Recommended Posts

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.

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...