Next in thread →
Next in month →
RE: [xml-dev] XSLT For-Loop technique
> What is the best way (if there is one) to implement the > equivalent of a for-loop in xslt? There isn't one, there are several, depending on the problem you want to solve. For iterating over a node-set, use xsl:apply-templates or xsl:for-each. For iterating over anything else (e.g. words in a sentence), use a recursive call on a named template. For iterating a fixed (small) number of times, a useful trick is: <xsl:for-each select="//*[position() <= $n]"> <td/> </xsl:for-each> In the XSLT 2.0 / XPath 2.0 working drafts there are much more powerful facilities for manipulating sequences. Michael Kay Software AG home: work:
Next in thread →
Next in month →