I am using the XPath for loop equivalent -
<xsl:for-each select="for $i in 1 to $length return $i">...
And I really need a count variable, how would I achieve this?
Thanks,
Ash.
Inside of the
<xsl:for-each select="for $i in 1 to $length return $i">...</xsl:for-each>
the context item is the integer value so you simply need to access .
or current()
.
First note that
for $i in 1 to $length return $i
is just a long-winded way of writing
1 to $length
Within the for-each, you can access the current integer value as "." or as position()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With