Stephane Bailliez wrote:
>It looks like in xalan 1, it was able to cope w/ a different separator
>than the locale one when none was defined explicitely.

You forgot to tell us about your locale. Also, we need to know if you used
xsl:decimal-format to change any characters. The JRE in use might also
affect the behavior.

>  <xsl:format-number(0.812345, '0.000')/>
>gives 0,812 w/ xalan 1.2.2
>gives 0001. w/ xalan cvs

Scott Boag says:
>Stephane, 0001. for <xsl:value-of select="format-number(0.812345,
>'0.000')"/> would certainly be incorrect....So I'm not sure what the
>explanation is for your results.

It could happen if all the following are true:
(A) 0.812345 was interpreted as a number slightly less than 1,
    meaning that . was a decimal-separator,
(B) '0.000' was interpreted as if '.' was the grouping-separator,
    possibly because of the locale,
(C) there was no xsl:decimal-format declaration to change separators

I *think* it could also happen if:
(A) 0.812345 was interpreted as a number slightly less than 1,
    meaning that . was a decimal-separator AND that the locale didn't try
    to change separators (or has no effect on literal numeric constants
    in XML),
(B) '0.000' was interpreted as if '.' was the grouping-separator,
    because xsl:decimal-format declared . as such (and also made ',' the
    decimal-separator)
In other words, flipping the separators via decimal-format might only
affect their interpretation in the pattern string, not the number.

>  <xsl:format-number(0.812345, '0.000')/>
>gives 0,812 w/ xalan 1.2.2

That looks wrong no matter what. It says that we used to produce the string
'0.812' for a number slightly less than one, then something in the locale
caused it to be serialized with a ',' replacing '.' despite the fact that
the value had clearly become a string. So i'd say that we're better than
we were in 1.2.2, if not necessarily correct. We have to cope with that
bizarre statement in the spec, "The format pattern string is in a localized
notation: the decimal-format determines what characters have a special
meaning in the pattern (with the exception of the quote character, which is
not localized)." Erratum E10 clarifies that if there is complete lack of an
xsl:decimal-format declaration, the special characters should be given the
default interpretation, which means '.' is the decimal-separator and ',' is
the grouping-separator, NOT that they are taken from the locale.
.................David Marston

Reply via email to