Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: translate function trims zeros on '1.00' and gives a simple '1' ?

From: "Neil Smith [MVP Digital Media]" <neil@------.--->
To: NULL
Date: 1/3/2009 12:03:00 AM
On Fri, 2 Jan 2009 14:49:01 -0800, Savvoulidis Iordanis
<SavvoulidisIordanis@d...> wrote:

>I'm creating a CSV (text) file out of a XML file. I'm using the following 
>expression so that when the XYZ field contains a value of let's say 3,54 it 
>must be converted to 3.54. And also if it contains (-) I want to replace it 
>with the value of 1.00
>While the 1st one works, when the field contains (-) I get a simple 1 and 
>not 1.00 in the output file. Why?
>
><xsl:value-of select="translate(translate(XYZ,',','.'),'-','1.00')


translate() function translates a list of (individual) characters to
other characters. It does not translate complete strings to other
strings.

So translate('A nice car', 'Aca', '123') would create an output string
translation like this :

A nice car   -> becomes :
1 ni2e 23r


HTH
Cheers - Neil
------------------------------------------------
Digital Media MVP : 2004-2009
http://mvp.support.microsoft.com/mvpfaqs


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent