This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Repeating a string
- From: "Filipe Correia" <filipe dot correia at paradigmaxis dot pt>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Wed, 05 Jun 2002 17:16:50 +0100
- Subject: Re: [xsl] Repeating a string
- References: <F1809aZ1i6bdVJWrGW600013ad3@hotmail.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
I would do something like this:
<xsl:template match="some/node/selection">
<xsl:call-template name="repeater">
<xsl:with-param i="20"/>
<xsl:with-param str="Hello"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="repeater">
<xsl:param name="i"/>0</xsl:param> <!-- defaul value-->
<xsl:if test="$i > 0">
<xsl:call-template name="repeater">
<xsl:with-param i="$i - 1"/>
<xsl:with-param str="$str"/>
</xsl:call-template>
<xsl:value-of select="$str"/>
</xsl:if>
</xsl:template>
Cheers,
Filipe
PS: I have not tested this but I think it would work.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list