Subject: RE: [xsl] repetition From: "Martinez, Brian" <brian.martinez@xxxxxxxxxxx> Date: Tue, 27 May 2003 12:55:23 -0600 |
> From: abbouh [mailto:abbouh@xxxxxxxxxxxxxxxxx] > Sent: Tuesday, May 27, 2003 11:10 AM > Subject: [xsl] repetition > > > i want to know how i can repeat an instruction in xsl > for example i want to display text "toto" n time > whithout repeating > <xsl:text>toto</xsl:text> n time. > thanks XSLT doesn't have procedural loop counters, but you can use recursion to get the same effect. At its simplest: <xsl:template name="text-loop"> <xsl:param name="max-times" select="1"/> <xsl:param name="i" select="0"/> <xsl:if test="$i < $max-times"> <xsl:text>toto </xsl:text> <xsl:call-template name="text-loop"> <xsl:with-param name="max-times" select="$max-times"/> <xsl:with-param name="i" select="$i + 1"/> </xsl:call-template> </xsl:if> </xsl:template> Usage: <xsl:call-template name="text-loop"> <xsl:with-param name="max-times" select="5"/> </xsl:call-template> Output: toto toto toto toto toto hth, b. | please note new address and phone #'s effective may 19 | | brian martinez brian.martinez@xxxxxxxxxxx | | lead gui programmer 303.357.3548 | | cheap tickets, part of trip network fax 303.357.3380 | | 6560 greenwood plaza blvd., suite 400 englewood, co 80111 | | cendant travel distribution services http://www.cheaptickets.com/ | XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] repetition, Vasu Chakkera | Thread | RE: [xsl] repetition, Onur Esnaf |
[xsl] How can the encoding of form, Carsten Bode | Date | [xsl] jfor doesn't work under linux, Simon Dotschuweit |
Month |