xsl-list
[Top] [All Lists]

RE: recursive call-template problem

2005-03-14 08:15:54
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/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>