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 21634 - format-number() suffix definition seems wrong
Summary: format-number() suffix definition seems wrong
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 3.0 (show other bugs)
Version: Candidate Recommendation
Hardware: All All
: P2 minor
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-09 02:54 UTC by Paul J. Lucas
Modified: 2013-04-23 17:11 UTC (History)
0 users

See Also:


Attachments

Description Paul J. Lucas 2013-04-09 02:54:33 UTC
XQuery Functions and Operators 3.0, section 4.7.4, says in part:

> The suffix is set to contain all passive characters to the right of the rightmost active character in the fractional part of the sub-picture.

Why doesn't that mirror the prefix definition?  The prefix definition is:

> The prefix is set to contain all passive characters in the sub-picture to the left of the leftmost active character.

Specifically, why does the definition for suffix include "the fractional part of"? Why isn't the definition of suffix worded as:

> The suffix is set to contain all passive characters to the right of the rightmost active character in the the sub-picture.

Including "the fractional part of" implies that, if there is no fractional part, then there can be no suffix.

For example, for the picture string "1%", the % character is considered "passive" according to section 4.7.3; yet the current wording implies that there is no suffix because the % does not occur in the fractional part.  The upshot is that, according to the formatting rules in 4.7.5, the % will NEVER be included in the result string.

However, if the wording is changed as I've proposed, then the % automatically becomes part of the suffix and gets included in the result as expected.
Comment 1 Michael Kay 2013-04-23 14:02:01 UTC
Actually the problem is subtly different from the way you describe it. The definition states: "The <var>fractional part</var> of the sub-picture is defined as the part that appears to the right of the <var>decimal-separator-sign</var> if there is one; it is a zero-length string otherwise.

So there is always a fractional part; the problem is (a) the statement that it is a zero-length string if there is no decimal-separator-sign, and (b) the subsequent assumption that it contains at least one active character.

So I think 

(a) we should change the definition so instead of "it is a zero-length string otherwise", we say "or the part that appears to the right of the rightmost active character otherwise", and add "The fractional part may be zero-length". 

(b) The problem that the fractional part may contain no active characters is then best dealt with by accepting your suggested wording: The suffix is set to contain all passive characters to the right of the rightmost active character in the the sub-picture.

I believe that these changes are editorial, in the sense that there is not really any alternative interpretation of what is written that would give different results. I have therefore classified the bug as "minor" and am resolving it as described here.

Paul, if you agree, please mark the issue closed, otherwise reopen and the full WG will look at it.