[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Replace $ with $$


Subject: RE: [xsl] Replace $ with $$
From: "Chris Bayes" <Chris@xxxxxxxxxxx>
Date: Fri, 9 Mar 2001 15:11:25 -0000

Micheal,
Just do it again
<xsl:template match="text()">
 <xsl:choose>
  <xsl:when test="contains(., '$')">
   <xsl:call-template name="doubleYourMoney">
     <xsl:with-param name="str" select="." />
  </xsl:when>
  <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
 </xsl:choose>
</xsl:template>

<xsl:template name="doubleYourMoney">
 <xsl:param name="str" />
 <xsl:choose>
  <xsl:when test="contains(., '$')">
   <xsl:value-of select="concat(substring-before(.,'$'),'$$')" />
   <xsl:call-template name="doubleYourMoney">
     <xsl:with-param name="str" select="substring-after(., '$')" />
  </xsl:when>
  <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
 </xsl:choose>
</xsl:template>

Ciao Chris

XML/XSL Portal 
http://www.bayes.co.uk/xml

><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



Current Thread