DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Str_repeat

04.24.2005
| 4087 views |
  • submit to reddit
        <!--
*** str_repeat
*** Returns str repeated multiplier times
*** Param str = the string
*** Param multiplier = the string
-->
-
	<xsl:stylesheet version="1.0">
-
	<xsl:template match="/">
<xsl:param name="string" select="'Hello'"/>
-
	<xsl:call-template name="str_repeat">
<xsl:with-param name="str" select="$string"/>
<xsl:with-param name="multiplier" select="number(10)"/>
</xsl:call-template>
</xsl:template>
-
	<xsl:template name="str_repeat">
<xsl:param name="str"/>
<xsl:param name="multiplier"/>
<xsl:param name="count" select="number(1)"/>
-
	<xsl:if test="$count <= $multiplier">
-
	<xsl:call-template name="str_repeat">
<xsl:with-param name="str" select="$str"/>
<xsl:with-param name="multiplier" select="$multiplier"/>
<xsl:with-param name="count" select="$count+1"/>
</xsl:call-template>
<xsl:value-of select="$str"/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>