Subject: Re: [xsl] Re: using format-number() for aligned text output From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Wed, 28 Mar 2001 11:58:30 -0500 |
> I was anticipating format-number(price,'####0.00') to always produce > a string of 8 characters in length, yet both processors I have (XT > and Saxon) are Java based and are using the Java library which is > known to have other problems for this function.
I thought that, since the format-number() function is specifically based on Java's DecimalFormat class, that using the Java library would be *more* reliable than copying the functionality in another language?
> Any alternative interpretations out there for the specification > wording of: "digit specifies the character used for a digit in the > format pattern; the default value is the number sign character (#)"? > Would anyone else expect the "#" to produce a space if no digit is > there? If that isn't the behaviour, then what is the utility of the > "#"?
In the format pattern, the # stands for an optional digit and the 0 stands for a required digit. So:
format-number(12345, '#,##0.00') => '12,345.00' format-number(1.5, '#,##0.00') => '1.50' format-number(0.543, '#,##0.00') => '0.54' format-number(12345, '#,###.##') => '12,345' format-number(1.5, '#,###.##') => '1.5' format-number(0.543, '#,###.##') => '.54'
-- G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995) Web site: XSL/XML/DSSSL/SGML/OmniMark services, training, products. Book: Practical Transformation Using XSLT and XPath ISBN 1-894049-06-3 Article: What is XSLT? http://www.xml.com/pub/2000/08/holman/index.html Next public instructor-led training: 2001-04-06,05-01,05-14,05-15, - 05-16,05-17,05-21,05-22,06-18,06-21,07-20,07-21,09-19
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Re: using format-number(), Jeni Tennison | Thread | Re: [xsl] Re: using format-number(), Jeni Tennison |
RE: [xsl] XSL, chris markiewicz | Date | Re: [xsl] CJK UTF-16 test, Benjamin Franz |
Month |