This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Replace $ with $$


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]