[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Number formating (format-number) and string to number

Subject: Number formating (format-number) and string to number function problem.
From: "Karen Yang" <kyang94@xxxxxxxxx>
Date: Thu, 6 Jul 2006 11:01:01 -0400
excel string to number

I'm converting the XML to Excel using XSLT 1.0, and now I'm having a
problem with the number result in Excel.

For example, I have a number stored as 1234.5678, and I'd like to see
1,234.57 as the final format, so I used format-number() function, but
that function would convert the result to string instead of a number,
so when I use
<Cell><Data ss:Type="Number"><xsl:value-of select="format-number(.,

The generated Excel would have problem opening, but if I change to:

<Cell><Data ss:Type="String"><xsl:value-of select="format-number(.,

The file could be opened, but all the numbers are stored as string, so
there would be a warning sign (little triangle on the left upper
corner) showed up in every cell that is number value but string type.

I also tried to use "number()" function as shown below, but it's very
strange that the result would be "NaN" for most values.

<Cell><Data ss:Type="String"><xsl:value-of
select="number(format-number(., '###,.00'))"/></Data></Cell>

So can sb. let me know what I should do in this situation? My main
goal is to have the number formated as ###..00.

And if I don't format the numbers,
<Cell><Data ss:Type="Number"><xsl:value-of select="."/></Data></Cell>

It would work just fine....

Since I'd like to wrap my current project up by today, I'd appreciate
any of your outputs.

Thanks in advance for your help,


Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.