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

Re: format-number in XSLT 1.0

Subject: Re: format-number in XSLT 1.0
From: Jack Matheson <jack@xxxxxxxxxxxxxx>
Date: Wed, 26 Jan 2005 11:00:17 -0600
java decimalformat
Many thanks for the great explanation!
format-number-1.0 was exactly what I was looking for.

The Xalan result is conformant with the XSLT 1.0 specification if you adopt
a generous interpretation of the spec; the Saxon 8.2 result is conformant
with the XSLT 2.0 specification.

In XSLT 1.0 format-number() was specified by reference to the JDK 1.1
specification of the DecimalFormat class. Unfortunately the JDK 1.1
documentation was very vague in a number of areas. The statement that the
negative subpicture is largely ignored appeared in the JDK documentation
only in later versions. It's very likely that an XSLT 1.0 implementation
built using Java will behave the way DecimalFormat actually behaves in the
version of Java that you are using, while an implementation built in a
different language is likely to do what a reader of the JDK 1.1
specification might have expected, namely that the negative subpicture means
what it says.


In XSLT 2.0 we decided to remove the dependency on the Java specification
and write a free-standing specification for format-number. In doing this, we
had to decide whether to make it behave the way Java behaved, or the way JDK
1.1 said it should behave; and by-and-large we chose the latter, because
that is what non-Java XSLT implementations are likely to have implemented.

So XSLT 2.0 doesn't carry forward this Java anomaly regarding negative
patterns. This is documented as something that may cause incompatible
behavior on some implementations, though since XSLT 1.0 is underspecified in
this area that's outside the control of the spec.

Saxon 8.2 has a free-standing implementation of format-number that doesn't
rely on the Java DecimalFormat class, so it should do exactly what XSLT 2.0
says.


If you need it, the old implementation remains available in Saxon 8.2 for
the time being under the name format-number-1.0().

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.