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

Re: Re: using format-number() for aligned text output

Subject: Re: Re: using format-number() for aligned text output
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 29 Mar 2001 14:43:41 +0100
c format number 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


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-2011 All Rights Reserved.