copy-string — Returns “count” copies of a string
Given a string, the copy-string
template creates n copies of the
string, when the value of n is
given by the count parameter.
<xsl:template name="copy-string">
<!-- returns 'count' copies of 'string' -->
<xsl:param name="string"></xsl:param>
<xsl:param name="count" select="0"></xsl:param>
<xsl:param name="result"></xsl:param>
<xsl:choose>
<xsl:when test="$count>0">
<xsl:call-template name="copy-string">
<xsl:with-param name="string" select="$string"></xsl:with-param>
<xsl:with-param name="count" select="$count - 1"></xsl:with-param>
<xsl:with-param name="result">
<xsl:value-of select="$result"></xsl:value-of>
<xsl:value-of select="$string"></xsl:value-of>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$result"></xsl:value-of>
</xsl:otherwise>
</xsl:choose>
</xsl:template>