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

Re: Number formating (format-number) and string to num

Subject: Re: Number formating (format-number) and string to number function problem.
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 6 Jul 2006 16:10:36 +0100
xml format number
XML is (essentially) an untyped format of marked up character strings,
so there is no concept in XML itself of a "number" or a "string".

so when you say

>  but that function would convert the result to string instead of a number,
> so when I use

you are confusng yourself. In the output there are no numbers or strings
just character data, and the question is, do you want to generate
<Data ss:Type="Number">1,234.57</data>
<Data ss:Type="Number">1234.57</data>
I expect that you want the latter, in which case you just need value-of
and no format-number.

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

you can not have commas in numeric literals in XPath you can't go
1,234+1 to get 1,235
and for the same reason number("1,234") is NaN.
I don't know wnything about excel but I expect that what you want to do
is have the cells entered as <Data ss:Type="Number">1234.57</data>
and just set up a style rule in excel that says when printing to format
the numbers with a comma.

If in doubt start up a spreadsheet in excel by hand that has numbers
formatted as you want, save as xml and then just look at the generated
xml and get xslt to generate that.


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.