Subject: Re: [xsl] 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 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> or <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. David
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Number formating (format-numb, Karen Yang | Thread | RE: [xsl] Number formating (format-, Michael Kay |
[xsl] Number formating (format-numb, Karen Yang | Date | RE: [xsl] Simple XSL styling questi, Michael Kay |
Month |