[Bug 29555] [FO31] 9.8.4.2 The Width Modifier

https://www.w3.org/Bugs/Public/show_bug.cgi?id=29555

Michael Kay <mike@saxonica.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

--- Comment #1 from Michael Kay <mike@saxonica.com> ---
Yes, this needs clarification. I don't think we thought about this very
carefully when migrating format-date/time from XSLT to F+O (the original
referred to xsl:number rather than format-integer, and xsl:number does not
allow grouping separators or optional digit signs in the picture).

I propose to change:

<old>
A format token containing more than one digit, such as 001 or 9999, sets the
minimum and maximum width to the number of digits appearing in the format
token; if a width modifier is also present, then the width modifier takes
precedence.
</old>

to

<new>
The presentation modifier implicitly defines a minimum and maximum width (for
example, the modifier 001 has a minimum and maximum width of 3, while #'##9
defines a minimum width of 1 and a maximum of 5. If a width modifier is also
present, then the width modifier takes precedence. Special rules apply to the
year, fractional seconds, and timezone components: see below. Values are
truncated to the maximum width only in cases where the meaning is still clear.
</new>

There are some non-trivial cases to consider:

* fractional seconds. We made a decision to treat a single-digit token
specially: [f1] means as many digits of precision as the implementation
chooses. What about things like [f##1] or [f9.99]? I propose: 

(a) in the fractional seconds component, an optional-digit-sign is not allowed
to precede a digit sign; in all other components, an optional-digit-sign is not
allowed to follow a digit sign.

(b) if the first presentation modifier in the fractional seconds component
consists of a single digit, this does not imply a minimum and maximum width of
one; rather it implies a minimum width of one and a maximum that is
implementation-dependent.

* years. It seems fairly intuitive that [Y##99] should output the year of death
of Augustus as "14", the death of Constantine as "337", and the current year as
"2016". But 2016 is formatted as "16" if you specify either [Y99] or [Y9,2-2].
So the rule is that truncation of significant high-order digits occurs only for
the year component, and it occurs if the maximum width has been set either
implicitly (using the first presentation modifier) or explicitly (using the
width modifier).

* timezones. We've got a very detailed set of examples for timezones, but they
don't include any with a '#'. I think the basic rule (as with integer-valued
components like months and seconds is that '#' is allowed in a leading position
but essentially has no effect.

This all suggests the need for some more test cases...

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Tuesday, 12 April 2016 14:49:53 UTC