xsl-list
[Top] [All Lists]

RE: formatting numbers

2004-05-27 09:13:18

If executed with saxon7 produces what I would expect which is


$ saxon7 fn.xsl fn.xsl

: 123,456,789.120
: 123'456'789.120


However saxon7 is mainly an xslt2 implementation and this is an XSLT1
question but saxon6 produces

$ saxon fn.xsl fn.xsl

: 123,456,789.120
: 123456789###.000

which is odd, but actually it looks like it isn't saxon bug 
really, that
was with instant saxon on windows (ie using Microsoft's JVM) 
saxon6 using sun's JVM produces the same as saxon7:

$ saxon fn.xsl fn.xsl

: 123,456,789.120
: 123'456'789.120


Actually, format-number() in XSLT 1.0 is defined by reference to the JDK 1.1
specification of the DecimalFormat class, which treats apostrophes in the
picture string specially. I don't have access to the JDK 1.1 spec right now,
but it's entirely possible that the behavior of Instant Saxon is "correct"
(because it's using a JDK 1.1 Java implementation) and that the behavior
under later Java VMs is technically incorrect, even if it's more usable.
However, the JDK 1.1 spec for DecimalFormat is very woolly, so anything
goes, really.

Fortunately in XSLT 2.0 the dependency on a particular version of Java has
been removed.

Michael Kay



<Prev in Thread] Current Thread [Next in Thread>