Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using loops in XSL..

Status
Not open for further replies.

ashvn

Programmer
Mar 21, 2001
33
MU
Hi!

Are there any equivalents of the VB Do..While or For..Next functions?
Let's say I have a var holding a value of 10 (can be any other numeric value). I have to dynamically create that number of textboxes, each having a name from 'txtNo0' to 'txtNo10'. Is there any way of doing that?

Thanks a lot!
:)
 
For loops you can use named templates:

Code:
<xsl:call-template name=&quot;MakeBoxRecursive&quot;>
  <xsl:with-param name=&quot;count&quot; select=&quot;10&quot;/>
</xsl:call-template>

<xsl:template name=&quot;MakeBoxRecursive&quot;>
  <xsl:param name=&quot;count&quot;/>
  <xsl:call-template name=&quot;MakeBox&quot;/>
  <xsl:if test=&quot;$count > 1&quot;>
    <xsl:call-template name=&quot;MakeBoxRecursive&quot;>
      <xsl:with-param name=&quot;count&quot;>
 	<xsl:value-of select=&quot;-1 + $count&quot;/>
      </xsl:with-param>
    </xsl:call-template>
  </xsl:if>
</xsl:template>

Oh, and &quot;$count > 1&quot; should be escaped with & g t ; (but if I leave out whitespaces it is converted back again).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top