|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: repetition
> From: abbouh [mailto:abbouh@xxxxxxxxxxxxxxxxx] > Sent: Tuesday, May 27, 2003 11:10 AM > Subject: 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








