Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - wrong number format >Thread Next - Re: wrong number format Re: wrong number formatTo: NULL Date: 12/9/2007 1:30:00 PM
joost wrote:
> Hello i have the following problem.
> I have a xml file where value 44.24688969 is in.
> I want to be the format 22,24 therefore i use in dreamweaver the
> format-number(value,'#,##.00') see codes.
I don't understand why "44.24688969" should be formatted as "22,24".
> When testing it i got the number 44.24188969 in the browser.
>
> Can anyone solve my problem to get the result to 44.24
Now you say "44.24" which is quite different from "22,24".
Assuming you want 44.24 then the following should help:
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<html lang="en">
<head>
<title>Example</title>
</head>
<body>
<xsl:apply-templates select="test"/>
</body>
</html>
</xsl:template>
<xsl:template match="test">
<table>
<tbody>
<xsl:apply-templates select="record"/>
</tbody>
</table>
</xsl:template>
<xsl:template match="record">
<tr>
<xsl:apply-templates select="value"/>
</tr>
</xsl:template>
<xsl:template match="value">
<td align="right"><xsl:value-of select="format-number(.,
'#,###.00')"/></td>
</xsl:template>
</xsl:stylesheet>
Works fine for me with IE 6, Firefox 2.0, Opera 9.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
