This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Replace $ with $$
- To: "XSL List" <xsl-list at lists dot mulberrytech dot com>
- Subject: [xsl] Replace $ with $$
- From: "Michael Lee" <mlee at kanhan dot com>
- Date: Fri, 9 Mar 2001 14:58:21 +0800
- Organization: kanhan.com
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi, I am working on an XSLT stylesheet which transforms XHTML into WML.
However, a dollar sign is used to indicate the beginning of a variable in
WML. In order to represent a dollar sign character, a sequence of two
dollar signs must be used.
Right now I am using the following template to replace $ with $$, but I know
that it will only apply to the first $ in the text node. How can I modify
the following template to make the processor replace all the $ within the
same text node?
<xsl:template match="text()">
<xsl:choose>
<xsl:when test="contains(., '$')">
<xsl:value-of select="concat(substring-before(.,
'$'),'$$',substring-after(., '$'))"/>
</xsl:when>
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
</xsl:choose>
</xsl:template>
Thanks in advance.
Michael Lee
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list