JoeMcGarvey
Programmer
Hi Sportsfans - I am stuck on an XSL problem. I have multiple XML nodes (games) that each have a value: wins, losses, ties.
In my xsl I set three variables at the top of the style sheet:
<xsl:variable name="wins">0</xsl:variable>
<xsl:variable name="losses">0</xsl:variable>
<xsl:variable name="ties">0</xsl:variable>
Then I call a template to loop through the nodes and total the number of wins, ties, and losses. The loop code returns an unexpected result. Here is the sample for wins:
<xsl:template match='entity' mode='record'>
<xsl:if test="number(HTScore)>number(ATScore)">
<xsl:variable name="wins" select="number($wins+1)"/>
<xsl:value-of select="number($wins)"/>
</xsl:if>
</xsl:template>
There are 4 total wins in the nodes, but "$wins" returns "1111". So the loop is appending a value of the win (1) each time, instead of performing the equation.
Any ideas what I am doing wrong?
In my xsl I set three variables at the top of the style sheet:
<xsl:variable name="wins">0</xsl:variable>
<xsl:variable name="losses">0</xsl:variable>
<xsl:variable name="ties">0</xsl:variable>
Then I call a template to loop through the nodes and total the number of wins, ties, and losses. The loop code returns an unexpected result. Here is the sample for wins:
<xsl:template match='entity' mode='record'>
<xsl:if test="number(HTScore)>number(ATScore)">
<xsl:variable name="wins" select="number($wins+1)"/>
<xsl:value-of select="number($wins)"/>
</xsl:if>
</xsl:template>
There are 4 total wins in the nodes, but "$wins" returns "1111". So the loop is appending a value of the win (1) each time, instead of performing the equation.
Any ideas what I am doing wrong?