W3C home > Mailing lists > Public > xsl-editors@w3.org > January to March 2001

XSLT 1.1 draft: no enhancement of format-number?

From: Arnold, Curt <Curt.Arnold@hyprotech.com>
Date: Thu, 4 Jan 2001 12:56:09 -0700
Message-ID: <B2C1451A181BD411B88A00E018C1C19C08A982@THOR>
To: "'xsl-list@lists.mulberrytech.com'" <xsl-list@lists.mulberrytech.com>
Cc: "'xsl-editors@w3.org'" <xsl-editors@w3.org>
I posted the following message back in December on xsl-editors@w3.org, but never got any feedback.  (http://lists.w3.org/Archives/Public/xsl-editors/2000OctDec/0250.html)


I was surprised that I did not see any noticeable change in the format-number function.  One of the annoying limitations of the XSLT 1.0 was a lack of any numeric formatting that was appropriate for
engineering values since scientific notation was only introduced in JDK 1.2.  

I had hoped that the Scientific Notation format patterns added in JDK 1.2 (http://www.javasoft.com/j2se/1.3/docs/api/java/text/DecimalFormat.html) would be incorporated into format-number in XSLT 1.1,
maybe with some appropriate fallback behavior for implementations running on JDK 1.1.


I would assume that other people here would like to see the currency formatting introduced in JDK 1.2 in addition to the scientific notation (my primary interest).

The original XSLT spec seemed to be written to make sure that a conforming processor could be deployed on JDK 1.1, hence the restriction that only JDK 1.1 defined formats are allowed.

I doubt (but haven't confirmed) that the popular implementations on Java would allow you to use JDK 1.2 and 1.3 compatible formats when you were running on those platforms.  However, of course,
depending on that behavior locks you into the Java platform.

I believe (but haven't confirmed) that it would be fairly simple to implement a DecimalFormatFactory that gives you a 1.3 compatible DecimalFormat on JDK 1.1 and later.  On JDK 1.3, it would just give
you the platform's DecimalFormat.  On earlier JDK's, it would wrap the decorate DecimalFormat to handle the new cases. 

For non-Java platforms, it would require extending the DecimalFormat implementation, but not in ways that should be a significant implementation burden.

My recommendation would be to basically replace reference to the JDK 1.1 DecimalFormat with a reference to JDK 1.3 DecimalFormat and extend <xsd:decimal-format> to have the new attributes to
DecimalFormatSymbols added since JDK 1.1 (international-currency-symbol, monitary-decimal-separator, currency-symbol on a quick glance).

If there is the possibility of that, I would be willing to take a shot at hacking a 1.3 compatible DecimalFormat for JDK 1.1.
Received on Thursday, 4 January 2001 15:02:12 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:44:21 UTC