Subject: zero-digit
From: Elliotte Rusty Harold <elharo@xxxxxxxxxxxxxxx>
Date: Thu, 30 Nov 2000 11:09:19 -0500
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?

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. ()

On the other hand, 0 is a special character used in decimal format patterns by java.text.DecimalFormat, just like # is. The # character represents a digit which IS NOT printed when it's an insignificant zero. The 0 represents a digit that IS printed if it's an insignificant zero. Otherwise 0 and # are the same. I think it is this use of 0 in decimal format patterns that was intended for the zero-digit attribute of xsl:decimal-number.

Assuming this analysis is correct, I think an erratum needs to be published for XSLT 1.0. This erratum should delete the current bullet point "zero-digit specifies the character used as the digit zero; the default value is the digit zero (0)" It should add the following bullet point to the list of "The following attributes control the interpretation of characters in the format pattern:

zero-digit specifies the character used for a zero digit in the format pattern; the default value is the zero character (0)

| Elliotte Rusty Harold | elharo@xxxxxxxxxxxxxxx | Writer/Programmer |
|                  The XML Bible (IDG Books, 1999)                   |
|                   |
|   |
|  Read Cafe au Lait for Java News: |
|  Read Cafe con Leche for XML News:     |

XSL-List info and archive:

Current Thread