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 28693 - Editorial: consistency in names relating to formatting decimals
Summary: Editorial: consistency in names relating to formatting decimals
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 3.1 (show other bugs)
Version: Working drafts
Hardware: PC Windows NT
: 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: 2015-05-22 21:38 UTC by Priscilla Walmsley
Modified: 2016-12-16 19:55 UTC (History)
1 user (show)

See Also:


Attachments

Description Priscilla Walmsley 2015-05-22 21:38:09 UTC
It would be more clear if the various names used in reference to formatting decimals were consistent across the following:

1. "Named properties" listed in the table under fn: format-number in F&O
2. Keywords used in the Decimal Format Declaration in XQuery
3. The names of the components in the static context in XQuery
4. The attributes of xsl:decimal-format in XSLT v.2 and 3

"digit" has 3 names: 
   digit (#2 and #4) vs.  digit-sign (#3) vs. optional-digit-sign (#1)

Some of the others have 2 names, where it is consistent in #2-#4 but "-sign" is added in F&O:

   decimal-separator vs. decimal-separator-sign
   grouping-separator vs. grouping-separator-sign
   exponent-separator vs. exponent-separator-sign
   percent vs. percent-sign
   per-mille vs. per-mille-sign
   zero-digit vs. mandatory-digit-sign
   pattern-separator vs. pattern-separator-sign

Others are consistent across all 4 (NaN, infinity, minus-sign).
Comment 1 Michael Kay 2015-05-23 18:30:44 UTC
I made an attempt at this during 3.0 development and found it very hard to fix. In fact, I think the text we have now is partly the result of a botched attempt to fix it. It's difficult to get it right when it runs across so many of the specs.

Obviously the keywords used in XSLT and XQuery cannot change; the question is whether other terms can be brought into line.

The distinction between the attribute name and the symbol name was originally deliberate; the decimal-separator-sign is the value of the xsl:decimal-format/@decimal-separator attribute or its default, and having different names avoids frequent repetition of this distinction. However, the introduction of decimal format property names into the static context made this rather unnecessary.

We do seem to have some inconsistencies that should definitely be ironed out, e.g. the definition of the static context says "[Definition: decimal-separator specifies the character used for the decimal-separator-symbol; the default value is the period character (.)]", but format-number calls it the decimal-separator-sign.

I don't think it's possible to achieve complete alignment. The attribute name "digit" is simply too generic to use in the text without qualification.

Another editorial point is what markup and rendition we should use for references to "things" in the static and dynamic context [and what are the "things" anyway? Variables, components, properties?]. Perhaps we should use <termref>/<xtermref>. Currently both <var> and <code> are used.
Comment 2 Priscilla Walmsley 2015-05-28 13:47:50 UTC
I can sympathize with the challenge of aligning all the names. Maybe you could get down to two sets of names:

1. The keywords in the Decimal Format Declaration and the attributes of xsl:decimal-format.  (These are already aligned.)

2. All other uses.  

I see now that there is a 5th set of names in the XSLT 2.0 and 3.0 specs where it talks about xsl:format-declaration. For example it says "minus-sign specifies the character used for the minus-symbol"  (with minus-symbol in italics as if it is an important keyword) I haven't seen "minus-symbol" anywhere else. 

As silly as it sounds, I think there should probably be a table in the XQuery spec (in the Decimal Format Declaration section?) that maps the keywords used in the declaration with the components of the static context.  While it should be fairly obvious to a reader that "digit" in the Decimal Format Declaration maps to "digit-sign" (or "optional-digit-sign") in the static context, this is after all a specification and it should be explicit.
Comment 3 Michael Kay 2015-06-02 11:45:46 UTC
(A)

First, the description of the static context (XQuery/XPath 2.1.1). I propose:

(A1) we align the names of the properties with the keywords used in XQuery and XSLT. The only change is digit-sign -> digit.

(A2) we call them properties, not attributes (currently both names are used).

(A3) we avoid the use of alternative terms within the definition, and instead explain the usage of the property in plain English. So for example

[Definition: decimal-separator specifies the character used for the decimal-separator-symbol; the default value is the period character (.)]

becomes

[Definition: decimal-separator specifies the character used to separate the integer part of the number from the fractional part; the default value is the period character (.)]

(B)

In XQuery 4.10, in the definition of "decimal format declaration", change the sentence "The mapping between these properties and the equivalent fn:format-number() properties is discussed in *statically known decimal formats*, which also specifies the defaults for each value." to read "If the form "decimal-format EQName" is used, then the declaration defines the properties of the decimal format whose name is EQName; while the form "default decimal-format" defines the properties of the decimal format with no visible name. The declaration contains a set of (DFPropertyName, StringLiteral) pairs, where the DFPropertyName is the name of the property and the StringLiteral is its value. The valid values and default values for each property are defined in *statically known decimal formats*."

(C) In XSLT 5.5

[C1] change the paragraph:

The attributes of the xsl:decimal-format declaration define the value of the corresponding attribute in the relevant decimal format in the Statically known decimal formatsXP30 component of the static context for all XPath expressions in the package. The attribute names used in the XSLT 3.0 syntax are the same as the attribute names used in the definition of the static context, except that the digit attribute of xsl:decimal-format corresponds to the digit-sign attribute in the static context.

to read:

The attributes of the xsl:decimal-format declaration define the value of the corresponding property in the relevant decimal format in the Statically known decimal formatsXP30 component of the static context for all XPath expressions in the package. The attribute names used in the XSLT 3.0 syntax are the same as the property names used in the definition of the static context.

[C2] Change other instances of "attribute" to "property" where appropriate.

[D] F+O

[D1] In the table in F+O 4.7.1, align the property names and descriptions with the names and descriptions used in the definition of the static context.

[D2] Replace all uses of the old F+O names with the static context property names, for example decimal-separator-sign becomes decimal-separator. Link these terms to their definitions in the XPath specification (replacing use of italics), and qualify them as "the X property" or "the value of the X property" where necessary for clarity, e.g.

In 4,7,3, "A picture-string consists either of a sub-picture, or of two sub-pictures separated by a pattern-separator-sign." becomes "A picture-string consists either of a sub-picture, or of two sub-pictures separated by the character that is the value of the *pattern-separator* property." 

In 4.7.5, "If the input number is positive or negative infinity, the result is the concatenation of the appropriate prefix, the infinity-symbol, and the appropriate suffix." becomes "If the input number is positive or negative infinity, the result is the concatenation of the appropriate prefix, the value of the *infinity* property, and the appropriate suffix."
Comment 4 Michael Kay 2015-06-04 09:14:30 UTC
I have applied the changes.

For the record, I also made the following change to bring the specs into line: The XQuery spec says that all the characters used in a picture string must be distinct, and enumerates these characters; but its enumeration only includes the "zero-digit", whereas in fact any character in the digit family starting with the zero-digit can be used in the picture string, and they are all protected by this constraint. For example, you can't use "3" as your percent character if you are using ordinary Western digits.

I will add a test for this condition.
Comment 5 Andrew Coleman 2015-06-05 08:47:35 UTC
At the teleconference on 2015-06-02, the working group agreed to accept the proposal in comment #3.

Many thanks for raising this.