[
Lists Home |
Date Index |
Thread Index
]
On Tue, 2003-12-23 at 09:24, David Tolpin wrote:
> My feeling is that every facet is unusual. For example, is '0.0' a
> canonical form for decimal zero?
Yes, the canonical form for zero, in the decimal type, is "0.0". As
section 3.2.3 says,
The canonical representation for decimal is defined by prohibiting
certain options from the Lexical representation
(§3.2.3.1). Specifically, the preceding optional "+" sign is
prohibited. The decimal point is required. Leading and trailing
zeroes are prohibited subject to the following: there must be at
least one digit to the right and to the left of the decimal point
which may be a zero.
> Decimal point is required according to the specification.
It's required in the canonical form, yes.
> If the decimal point is required, how can 'integer' be derived from
> 'decimal'?
The decimal point is not required in the lexical form of an
integer-valued decimal. (It is required in the *canonical* form, but
the set of canonical forms is not the same as the lexical space.)
Non-primitive simple types are derived from others by restricting
their value and lexical spaces; integer is derived from decimal by
restricting the value space to integral values. The canonical form is
a convenience, primarily for use by others who want for whatever
reason to restrict the possible variation of lexical forms, and is
specified for each built-in type 'by magic'. (If there were a good
platform-independent way to specify a value-to-lexical-form mapping, I
suspect the WG would have preferred to do canonical forms without
magic, but I don't know of any good way to specify such mappings.)
> If the decimal point is not required, but the canonical form for
> '0.00' is '0.0', what is the number of totalDigits?
> Is it the same as '0'
> How many digits are in decimal '0'?
I'm not quite sure how best to interpret your question. Total digits
is defined as a facet for constraining a value space, not as a direct
characteristic of values. It constrains the lexical space only
indirectly, the way all facets that work directly on the value space
do (if a lexical form denotes a value excluded from the value space,
it's no longer a legal lexical form).
We can, however, take the 'minimum total digits' of a value V to mean
the smallest value for the total-digits facet which retains V in the
value space, and that is a useful characteristic to know. If we
wished to associate a 'total digits' characteristic with a particular
lexical form, the only plausible way to do so for XML Schema 1.0 would
be to say that the total digits associated with a given lexical form
is the minimum total digits of its value.
Section 4.3.11 (as corrected) reads:
[Definition:] totalDigits controls the maximum number of values in
the value space of datatypes derived from decimal, by restricting
it to numbers that are expressible as i × 10^-n where i and n are
integers such that |i| < 10^totalDigits and 0 <= n <= totalDigits.
The value of totalDigits must be a positiveInteger.
Since we can express zero as 0 × 10^-0 (i = 0, n = 0), the lowest
legal value of totalDigits which includes zero in the value space is
1, which is the lowest legal value of totalDigits, period.
So the minimum total digits of the decimal value zero is 1, whether we
express the value using the lexical form "0" or "0.0" or "00000.00".
All these forms map to the same value, and the effect of the
totalDigits facets is defined in terms of values, not in terms of
lexical forms.
I hope this helps.
-C. M. Sperberg-McQueen
World Wide Web Consortium
|