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 29615 - [F+O 3.1] roman and max-width year
Summary: [F+O 3.1] roman and max-width year
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 Linux
: P2 normal
Target Milestone: ---
Assignee: Jonathan Robie
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-07 11:29 UTC by Benito van der Zander
Modified: 2016-07-21 14:19 UTC (History)
5 users (show)

See Also:


Attachments

Description Benito van der Zander 2016-05-07 11:29:41 UTC
Comment 10 in #29555 seems as if it could just as well apply to years that then are formatted Roman numbers.

Printing 2007 with '[Yi,3-3]' as vii instead as mmvii like in test case format-dateTime-006
Comment 1 Michael Kay 2016-05-07 16:38:07 UTC
So how would you use that rule to format the year 1999? I don't think years in roman numerals have ever been expressed modulo 100, and if they had, you couldn't express the requirement to do so by means of a minimum or maximum width.
Comment 2 Benito van der Zander 2016-05-07 21:23:09 UTC
999 ?  cmxcix

Makes as much sense as truncating year 654321  to 54321 with max width 5
Comment 3 Josh Spiegel 2016-05-09 15:45:13 UTC
The point of the truncation logic is to get the year to fit within the maximum width.  

format-date(xs:date("1998-01-01"), "[Y,2-2]") => 98
format-date(xs:date("1999-01-01"), "[Y,2-2]") => 99

If we applied this logic in the case of roman numerals, it would fail to print a value within the maximum width in many cases.  

format-date(xs:date("1998-01-01"), "[Yi,2-2]") => xcviii (instead of mcmxcviii)
format-date(xs:date("1999-01-01"), "[Yi,2-2]") => xcix (instead of mcmxcix)

And in some cases it will unnecessarily truncate the value. 

format-date(xs:date("0101-01-01"), "[Yi,2-2]") => i (instead of ci)
Comment 4 Liam R E Quin 2016-05-09 18:10:45 UTC
On the whole people working with Roman numerals and fixed-width fields are in for a hard time, and will probably use string processing to do what they need. It seems specialist enough that I've no clue how to predict a "majority" use case.

Josh's result - apply the width in decimal before conversion - and Benito's - apply the width in characters after conversion - both seem plausible and I don't see any reason to prefer one over the other in general.

Benito, when you opened this bug you didn't say that anything was wrong, nor what goes wrong, nor what you think ought to happen. Is anything wrong with the spec here?
Comment 5 Benito van der Zander 2016-05-09 19:37:57 UTC
I implemented comment 10 of #29555 and afterwards that test case failed

The comment says to truncate the year if there is a max width without exception

The specs says somewhere

>If no mechanism is available for fitting the value within the specified maximum width (for example, when roman numerals are used), then the value should be output in its full representation.


but the comment provides a mechanism for the year and it gets shorter, even if it stays too long.
Comment 6 Benito van der Zander 2016-05-09 19:44:35 UTC
>Josh's result - apply the width in decimal before conversion - and Benito's - apply the width in characters after conversion - both seem plausible 

You switched me and Josh
Comment 7 Abel Braaksma 2016-06-14 16:36:52 UTC
Please note that we currently say the following already about roman numerals and the width modifier:

"If no mechanism is available for fitting the value within the specified maximum width (for example, when roman numerals are used), then the value should be output in its full representation."
Comment 8 Abel Braaksma 2016-06-14 16:43:24 UTC
(which typically means that implementations are allowed to do as they wish if they feel that there is such mechanism, making it implementation-defined what happens if you try to truncate roman numerals, but the suggestion of the text, by means of "should", is to do nothing in such cases)
Comment 9 Andrew Coleman 2016-06-17 10:20:57 UTC
At the meeting on 2016-06-14, the WG discussed this and acknowledge the comment. This will be used as input to the existing action item A-643-01 (MikeK to update proposal on Bug 29555)