[xsl] Replace $ with $$

Subject: [xsl] Replace $ with $$
From: "Michael Lee" <mlee@xxxxxxxxxx>
Date: Fri, 9 Mar 2001 14:58:21 +0800
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:when test="contains(., '$')">
   <xsl:value-of select="concat(substring-before(.,
'$'),'$$',substring-after(., '$'))"/>
  <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>

Thanks in advance.

Michael Lee

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread