For loop template code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<xsl:template name=”for.loop”> <xsl:param name=”i” /> <xsl:param name=”count” /> <xsl:if test=”$i <= $count”> <div><xsl:value-of select=”$i”/><br/></div> </xsl:if> <xsl:if test=”$i <= $count”> <xsl:call-template name=”for.loop”> <xsl:with-param name=”i”> <xsl:value-of select=”$i + 1″/> </xsl:with-param> <xsl:with-param name=”count”> <xsl:value-of select=”$count”/> </xsl:with-param> </xsl:call-template> </xsl:if> </xsl:template> |
To Call template:
1 2 3 4 |
<xsl:call-template name=”for.loop”> <xsl:with-param name=”i”>1</xsl:with-param> <xsl:with-param name=”count”>5</xsl:with-param> </xsl:call-template> |