This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 21560 - Decimal format names/properties don't match
Summary: Decimal format names/properties don't match
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 3.0 (show other bugs)
Version: Candidate Recommendation
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-03 04:28 UTC by Paul J. Lucas
Modified: 2013-07-09 07:31 UTC (History)
0 users

See Also:


Attachments

Description Paul J. Lucas 2013-04-03 04:28:34 UTC
"XQuery 3.0: An XML Query Language" (herein referred to as [XQ3]), section 4.10, "Decimal Format Declaration," says in part:

> The following properties represent characters used in a picture string: decimal-separator-sign, grouping-separator, percent-sign, per-mille-sign, zero-digit, digit-sign, and pattern-separator-sign.

"XPath and XQuery Functions and Operators 3.0" (herein referred to as [F&O]), section 4.7.1, "Defining a decimal format," says in part:

> Each decimal format provides a set of named variables, described in the following table:

First inconsistency: [XQ3] uses the term "properties"; [F&O] uses the term "variables" -- why?

[F&O] continues to list the variables in the table:

> decimal-separator-sign, grouping-separator-sign, infinity, minus-sign, NaN, percent-sign, per-mille-sign, mandatory-digit-sign, optional-digit-sign, pattern-separator-sign.

Other inconsistencies:
[XQ3] uses "zero-digit"; [F&O] uses "mandatory-digit-sign."
[XQ3] uses "digit-sign"; [F&O] uses "optional-digit-sign."

Do these properties/variables refer to the same thing?  If so, why don't they have the same names?
Comment 1 Michael Kay 2013-04-03 09:50:01 UTC
There are several levels of indirection involved here. However, it's true that the terminology isn't as consistent as it might be.

The XQuery and XPath specs talk of the static context having "components" of which Statically Known Decimal Formats is one. The individual parts of this component (for example decimal-separator) are referred to both as "properties" and as "attributes". I think it would make sense to standardize on "properties".

The names of these properties match the XQuery keywords used to set the properties in all cases but one: the keyword "digit" is used to set the property "digit-sign". There's no absolute necessity for the names to match: a different host language might use different keywords. But since XSLT uses the same keywords (in xsl:decimal-format) as XQuery, it would make sense to remove this single discrepancy.

In F+O, the table in section 4.7.1 is a description of what the static context contains, and as such it should give the same information as the bullet points in section 2.1.1 of the XQuery and XPath specifications. As you point out, the names of the properties are different. The history here appears to be that XSLT 2.0 deliberately chose to distinguish the name of the property (or variable, as it was then called) from the name of the attribute used to set the property. When these properties were first added to the XQuery/XPath static context, the variable names from the XSLT 2.0 specification were used, but they were subsequently changed so that (in all cases but one) they matched the XQuery keywords. However this renaming never found its way into the F+O specification, probably because it was deemed "editorial".

Unfortunately, simply using the XSLT/XQuery keywords throughout in F+O could cause some confusion (which may be why XSLT 2.0 had the indirection in the first place). For example, changing the sentence "A sub-picture must contain at least one character that is an optional-digit-sign or a member of the decimal-digit-family." to "A sub-picture must contain at least one character that is a digit or a member of the decimal-digit-family." would be seriously misleading, since "digit" here refers to the character conventionally represented as "#".

So I think the answer is to retain the indirection, but to provide a mapping from property names to variable names in the table in 2.1.1.
Comment 2 Michael Kay 2013-04-23 14:52:15 UTC
I have changed F+O to use the term "property" when referring to parts of a decimal format in the static context. I think that is the only change I can reasonably make to F+O at this stage.

XSLT's description of xsl:decimal-format needs some work to explain the relationship to the decimal formats in the static context.

XQuery has some minor inconsistencies. It needs to be internally consistent talking about attributes, properties, or variables, and it needs to explain that for the most part the keywords used in "declare decimal format" are the same as the property names, the exception being that the keyword "digit" maps to the property named "digit-sign".
Comment 3 Michael Kay 2013-07-09 07:31:29 UTC
At its meeting on 2 July 2013 the WG agreed that this was essentially editorial and that the actions described in comments #1 and #2 were adequate to fix the problem. Therefore marking as resolved. If this is acceptable, please close the bug.