XML
In XSL, you do have variables but you cannot assign them values at runtime, so I suppose it would be more approriate to call them constants. XSL does have one useful function that returns a number which corressponds to the number of times a loop has occurred:
<xsl:for-eachselect="people/person"> <xsl:value-ofselect="position()"/></xsl:for-each>
Anyway, getting back to variables, you declare them like this:
<xsl:variable name="myvar">myvalue</xsl:variable>
To get the value of a variable use:
<xsl:value-of select="$myvar"/>
Page 5 of 6
This article was originally published on November 20, 2002