-1

Hello,

I am currently trying to use the code below to increment the currentChild after every iteration. However, in the output shown below, it is apparent that the value is never changing.

There are four children in this example, so it is printing out the statements the correct number of times, just not incrementing the value.

What can I do to keep track of the currentChild count?

Thanks.

Code:

<xsl:param name="currentChild">0</xsl:param>

<xsl:for-each select="Attribute[./@name='Children.Name']/Value">
   <xsl:value-of select="$currentChild"/> before increment<br/>
   <xsl:with-param name="currentChild" select="$currentChild+1"/>
   <xsl:value-of select="$currentChild"/> after increment<br/>
</xsl:for-each>

Output:
0 before increment
0 after increment
0 before increment
0 after increment
0 before increment
0 after increment
0 before increment
0 after increment

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by dph729
0

I don't think variables in XSL are mutable.

No, they're not. "Variable" is really a misnomer.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.