March 1, 2021
Hot Topics:


  • By Sam Huggill
  • Send Email »
  • More Articles »

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

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date