> Stephane Bailliez wrote:
> 
> Hi,
> 
> It looks like there is some kind of regression w/ format-number /
> decimal-format, but I'm unsure if this is a regression or a stricter
> conformance.
> Thinking about it, it might be normal...
> 
> <xsl:format-number(0.812345, '0.000')/>
> gives 0,812 w/ xalan 1.2.2
> gives 0001. w/ xalan cvs

I believe that this is correct.  I'm assuming from your later statement
("It works well if I define <xsl:decimal-format ...>") that you don't
have an xsl:decimal-format element present when you get the 0001. I'm
also assuming that you're in a locale where the "." is the grouping
separator.

The first argument to format-number is an XPath Number.  In an XPath
Number, the decimal separator is always a ".".  It is not locale
dependent.

So, the pattern basically says to yield a whole number with a "."
grouping separator.  The number 0.812345 is rounded to the nearest 
whole number, which is 1, and this is what you're getting.  I'm not sure
why you're getting the trailing "." though.  It shouldn't be there.

> 
> <xsl:format-number(0.812345, '0.00%')/>
> gives 81,23% w/ xalan 1.2.2
> gives 0081.% w/ xalan cvs
> 

The "%" sign in the pattern format says to multiply the number by 100. 
This is what is done here.  0.812345 * 100 = 81.2345.  This is rounded
to the nearest whole number and is then output as 81%.  Again, I'm not
sure why you're getting the "." between the 1 and the % but I'm going to
look into that.

> I can enter this as a bug if this is a real regression, just tell me.

So, I'd say that Xalan CVS is working (almost) correctly and the 1.2.2
was in error.

I've tried to duplicate this on the current CVS but I'm getting a
"Malformed format string" exception so I'm looking into that and into
your trailing decimal point.

I'll keep you posted.

Gary

Reply via email to