|
Subject: Re: Documentation on string-replace From: David Carlisle <davidc@xxxxxxxxx> Date: Thu, 17 Feb 2000 23:39:15 GMT |
> I have seen some references to a string-replace function in XSL and
'tis a little routine of mine.
<!-- replace all occurences of the character(s) `from'
by the string `to' in the string `string'.-->
<xsl:template name="string-replace" >
<xsl:param name="string"/>
<xsl:param name="from"/>
<xsl:param name="to"/>
<xsl:choose>
<xsl:when test="contains($string,$from)">
<xsl:value-of select="substring-before($string,$from)"/>
<xsl:value-of select="$to"/>
<xsl:call-template name="string-replace">
<xsl:with-param name="string" select="substring-after($string,$from)"/>
<xsl:with-param name="from" select="$from"/>
<xsl:with-param name="to" select="$to"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
there are some examples of its use in the faq I think.
David
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: Documentation on string-replace, Jennifer Moter | Thread | Re: Inclusion of XML data in Javasc, Nilay . Shah |
| Documentation on string-replace, Ben Bertola | Date | Re: XT as servlet, Kirk V. Hastings |
| Month |