XSLT : Looping from 1 to 60

In XSLT 2.0,

<xsl:for-each select="1 to 60">...</xsl:for-each>

But I guess that you must be using XSLT 1.0, otherwise you wouldn’t be asking.

In XSLT 1.0 you should use recursion: a template that calls itself with a counter that’s incremented on each call, and the recursion terminates when the required value is reached.

Alternatively there’s a workaround in XSLT 1.0: provided your source document contains at least 60 nodes, you can do

<xsl:for-each select="(//node())[60 >= position()]">...</xsl:for-each>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)