August 2001
Intermediate to advanced
480 pages
11h 16m
English
The simple answer: you don’t. What XSLT calls variables are
variables in the mathematical sense of the term. An
<xsl:variable> can be assigned an initial
value, but it can’t be changed. The upshot of this situation is
that you can’t implement a for loop as you
typically do in most procedural programming languages. However,
earlier in the book we did implement a stylesheet that emulates a
for loop. See Section 4.7 in Chapter 4 for a complete discussion of this example.
It’s much more likely that you need to iterate across a group of nodes in an XML document. If that’s the case, see Section 4.2.3 in Chapter 4 for more information.