Re: zero-digit

Elliotte Rusty Harold wrote:
> 
> It strikes me that the text describing the zero-digit attribute of
> the xsl:decimal-format element in the XSLT 1.0 spec may be wrong.
> What is stated in Section 12.3 is:
> 
> zero-digit specifies the character used as the digit zero; the
> default value is the digit zero (0)
> 
> The issues with this:
> 
> 1. Why can we specify 0 but not 1 through 9?

It's unnecessary.  In Unicode, decimal digits have consecutive codes. If
you specify a character with Unicode code N for 0, it will use N+1 for
1, N+2 for 2, etc.

> 2. Changing the character used for 0 is not allowed by the
> java.text.DecimalFormat class after which format-number and
> xsl:decimal-format is modeled. ()

You are mistaken. java.text.DecimalFormatSymbols.setZeroDigit() does
precisely this.

> On the other hand, 0 is a special character used in decimal format
> patterns by java.text.DecimalFormat, just like # is.

That is perfectly consistent with the XSLT spec.  zero-digit is included
in the list of attributes that both control the interpretation of
characters in the format pattern and specify characters that may appear
in the result of formatting the number not in the list of attributes
that only specify characters that may appear in the result of formatting
the number.

James

Received on Friday, 1 December 2000 00:56:58 UTC