[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Repeating a string


Subject: Re: [xsl] Repeating a string
From: "Filipe Correia" <filipe.correia@xxxxxxxxxxxxxxx>
Date: Wed, 05 Jun 2002 17:16:50 +0100

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



Current Thread