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 10792 - [FO3.0] format-integer - errors, negative values
Summary: [FO3.0] format-integer - errors, negative values
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 3.0 (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: 2010-09-28 10:23 UTC by Michael Kay
Modified: 2011-01-28 23:38 UTC (History)
1 user (show)

See Also:


Attachments

Description Michael Kay 2010-09-28 10:23:38 UTC
Further to bug #10729, two more questions about the spec of format-integer for the WGs to consider:

(a) Formatting of negative numbers. We currently say it should prepend a minus sign. This is needlessly different from xsl:number, which reverts to decimal notation, outputting -1 as -1 regardless of the formatting requested. With the format picture "a", -1 probably makes more sense than -a. But with format picture "w", "minus one" seems preferable to "-one".

(b) Errors, especially errors in the format picture. At present, no error conditions are described. I think we should follow the precedent of format-date, which is that a syntax error in the format picture is a hard error, but requesting something that the implementation doesn't support (e.g. an unsupported language) always causes the number to be output in a fallback representation rather than causing an error. This leaves a question as to whether syntax errors in the format picture are possible. I think they are - for example, no alphanumeric characters in the picture, or two adjacent punctuation characters (grouping separators), or unmatched parentheses after the "o" format modifier.
Comment 1 Michael Kay 2010-11-01 09:26:58 UTC
The WG agreed with the principle behind these two changes, MK has the action to draft detailed text.
Comment 2 Michael Kay 2010-11-23 10:38:54 UTC
Detailed proposal (in section 4.5.1, format-integer):

(a) Remove this paragraph: "The rules that follow describe how non-negative numbers are output. If the value of $value is negative, the rules below are applied to the absolute value of $value, and the result is prepended with a minus sign."

(b) After the paragraph starting "For all format tokens other than the first kind above...", add a new paragraph:

"If the number to be formatted is negative, the same principles apply. For some numbering sequences there is a natural way of representing negative numbers: for example |-5| in the case of format token "1", or |minus five| in the case of format token "w". For other sequences, there is no natural representation of negative numbers, and in such cases they should be output as if format token "1" had been used."

(c) Add an "Error Conditions" section to the entry:

An error is raised [FODF1290] if the value of $picture is syntactically invalid (for example, if it is empty, or contains unmatched parentheses after the |o| format modifier, or contains two adjacent grouping separators. No error is raised, however, when the picture is syntactically valid but does not represent any numbering sequence supported by the implementation; in this case the processor MUST fall back to representing the number as if the picture were specified as |1|.
Comment 3 Michael Kay 2011-01-11 16:18:24 UTC
The proposal in comment #2 was accepted
Comment 4 Jim Melton 2011-01-28 23:38:25 UTC
Because the proposal in comment #2 was accepted, and you are the reporter of the bug and the author of the accepted solution, and you were present when the decision was made, I have marked the bug RESOLVED/FIXED and the marked it CLOSED.