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

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