I call this template to substitute ' with \' for javascripts.
You can change it to make it substitute other chars.

How I call it:

<xsl:call-template name="fixQuotes">
  <xsl:with-param name="do.quote">'</xsl:with-param>
  <xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param>
</xsl:call-template>

The template:

  <xsl:template name="fixQuotes">
   <xsl:param name="do.quote"/>
   <xsl:param name="string"/>
   <xsl:choose>
     <xsl:when test="$do.quote">
       <xsl:choose>
         <xsl:when test="contains($string, &quot;'&quot;)">
           <xsl:value-of
             select="substring-before($string, &quot;'&quot;)"/>
           <xsl:text>\'</xsl:text>
           <xsl:call-template name="fixQuotes">
             <xsl:with-param name="do.quote" select="$do.quote"/>
             <xsl:with-param name="string"
               select="substring-after($string, &quot;'&quot;)"/>
           </xsl:call-template>
         </xsl:when>
         <xsl:otherwise>
           <xsl:value-of select="$string"/>
         </xsl:otherwise>
       </xsl:choose>
     </xsl:when>
     <xsl:otherwise>
       <xsl:value-of select="$string"/>
     </xsl:otherwise>
   </xsl:choose>
</xsl:template>

--
Nicola Ken Barozzi                   [EMAIL PROTECTED]
            - verba volant, scripta manent -
   (discussions get forgotten, just code remains)
---------------------------------------------------------------------


----- Original Message -----
From: Ferran Urgell
To: [EMAIL PROTECTED]
Sent: Tuesday, April 02, 2002 11:17 AM
Subject: Transformation comma-point


Hi Cocooners!

I've a problem:
I'm getting xml from a database, but I'm getting some results (number
results with decimals), but these results are in commas (ex. 123,34).

Now I'm trying to make some transformation into svg, but don't accept the
commas....
I need to change this commas to points...

The question is: How I can do this ?

Thanks

Ferran Urgell


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to