Quantcast
Channel: Development With A Dot
Viewing all articles
Browse latest Browse all 404

XSLT For Loop

$
0
0

If you ever need to implement a for loop in XSLT, here’s one possibility:

   1:<xsl:templatename="for">
   2:<xsl:paramname="from"/>
   3:<xsl:paramname="to"/>
   4:  
   5:<xsl:iftest="$from &lt;= $to">
   6:<xsl:variablename="newfrom"select="$from+1"/>
   7:  
   8:         Here I am! <xsl:value-ofselect="$from"/>
   9:  
  10:<xsl:call-templatename="for">
  11:<xsl:with-paramname="from"select="$newfrom"/>
  12:<xsl:with-paramname="to"select="$to"/>
  13:</xsl:call-template>
  14:</xsl:if>
  15:</xsl:template>

Viewing all articles
Browse latest Browse all 404

Trending Articles