[Bug 3163] [XSLT 2.0] format-time(): an oddity with fractional seconds

http://www.w3.org/Bugs/Public/show_bug.cgi?id=3163

           Summary: [XSLT 2.0] format-time(): an oddity with fractional
                    seconds
           Product: XPath / XQuery / XSLT
           Version: Candidate Recommendation
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLT 2.0
        AssignedTo: mike@saxonica.com
        ReportedBy: mike@saxonica.com
         QAContact: public-qt-comments@w3.org


This issue has been discussed by email within the Working Group: this bug is
being raised to capture the issue and its resolution.

The issue is this:

The default presentation modifier for "f" (fractional seconds) is "1".

We say:

A format token containing leading zeroes, such as 001, 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.

So the format token "1" doesn't set a minimum or maximum width (because it
contains no leading zeroes).

It's a little odd that f001 gives you fractional seconds to three places,
f01 to two places, and f1 to however many places the system fancies. But
since "1" is the default this is just as well. If you want exactly one
decimal place you have to write [f,1-1].

Resolution:

We agreed that although the effect might be a little surprising, the user could
always achieve what they wanted with an explicit width specifier, and it would
be undesirable to introduce new syntax incompatible with xsl:number. The editor
was asked to draft a Note to add to the spec. The proposed Note is as follows:
in 16.5.1, after the paragraph

"A format token containing leading zeroes, such as 001, 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."

add

"Note: a format token consisting of a one-digit on its own, such as "1", does
not constrain the number of digits in the output. In the case of fractional
seconds in particular, [f001] requests three decimal digits, [f01] requests two
digits, but [f1] will produce an implementation-defined number of digits. If
exactly one digit is required, this can be achieved using the component
specifier [f1,1-1]" 

This change has been applied.

Received on Thursday, 27 April 2006 21:39:06 UTC