RE: [xsl] recursive call-template problem

Subject: RE: [xsl] recursive call-template problem
From: "Aron Bock" <aronbock@xxxxxxxxxxx>
Date: Mon, 14 Mar 2005 15:15:54 +0000
omprakash

Also, How do I express the following in xsl:

Procedural code begin:

while (count > 0) {
   put <td>
  count--;
}

One way is to call recursively, like so. The following, untested, prints "foo" 10 times:


<xsl:call-template name="do-something">
   <xsl:with-param name="iter" select="10"/>
</xsl:call-template>


<xsl:template name="do-something"> <xsl:param name="iter" select="0"/>

   <xsl:if test="$iter > 0"
       <xsl:text>foo</xsl:text>
       <xsl:call-template name="do-something">
           <xsl:with-param name="iter" select="$iter - 1"/>
       </xsl:call-template>
   </xsl:if>
</xsl:template>


Regards,


--A

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar  get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


Current Thread