Removing trailing decimals

The latest XSLT 2 draft says:

The rules for the format-number function have been changed so that if an 
integer (say 3) is formatted using the picture 0.##, the result is "3" 
rather than "3." — that is, a number will never be output with a 
trailing decimal point.

The relevant text in the spec seems to be:

If there is no decimal-separator-sign in the sub-picture, or if there 
are no digits to the right of the decimal-separator-sign character in 
the string, then the decimal-separator-sign character is removed from 
the string (it will be the rightmost character in the string).

While I accept that most of the time this is what is desired, there are 
exceptions. It's long been the custom in C and C-like languages to use 
literals such as 3. to indicate a floating point literal rather than an 
integer literal. This change could be problematic for XSLT stylesheets 
that generates C code, and code in similar languages.

I'm not sure this is worth fixing, but I think it might be. It would be 
nice if the picture string had some way to indicate that a decimal 
separator should not be dropped, even if there's non trailing digit.

Please consider this a comment to be addressed. I doubt I'll register a 
formal objection if the WG decides this use case is too far out to be 
catered to, but I would like an official disposition, even if it's just 
  a decision not to handle this. Thanks.

-- 
Elliotte Rusty Harold  elharo@metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim

Received on Saturday, 12 February 2005 12:51:45 UTC