RE: [xsl] xsl:for or xsl:repeat

Subject: RE: [xsl] xsl:for or xsl:repeat
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 24 May 2006 16:41:21 +0100
> I'm looking for a function similar to to for-each, but 
> instead I will have a value passed from the xml which will be 
> a number and I will have to iterate for that number. What I need is:
> eg <xsl:for nooftimes="2">

In XSLT 2.0 use

<xsl:for-each select="1 to $n">

In XSLT 1.0 the usual workaround is

<xsl:for-each select="//node()[position() &lt; $n]">

Michael Kay

Current Thread