Re: Re: using format-number() for aligned text output
Hi Ken, > Consider: > > format-number(-12345, '#,###.00;(#)') > > The above produces "(12,345)" in Java-based processors and (I'm > told) "(12345)" in C++-based processors. I believe the C++-based > processors are correct. For all of my tests of negative number > syntax in the grammar, they are *all* being ignored and supplanted > by the positive number syntax in Java-based processors. FWIW, Both MSXML (which is C++ based, I believe) and Saxon produce '(12,345.00)' with the above. Of course MSXML might be emulating Java bugs. Perhaps the reason is hidden away in the definition of the DecimalFormat class. Under applyPattern and applyLocalizedPattern it says: "In negative patterns, the minimum and maximum counts are ignored; these are presumed to be set in the positive pattern." The 'counts' are the number of integer and fraction digits. On the other hand, I don't see anything anywhere about the percent or permille characters being treated as non-significant characters in the negative pattern, but both Saxon and MSXML treat them as such: format-number(-12345, '#,###.00;(#%)') => (12,345.00%) Also, I would have expected the groupings to be affected, but they aren't in either implementation: format-number(-12345, '#,###.00;(##,##.00)') => (12,345.00) > Where does one draw the line between empirical evidence and > functional definition? This question is being raised in the OASIS > XSLT/XPath conformance committee. I imagine it's particularly tricky with format-number(), where the *syntax* is defined without actually describing the *behaviour* you might get from it. Perhaps this is something that might be tidied up in XSLT 1.1? Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format