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 3163 - [XSLT 2.0] format-time(): an oddity with fractional seconds
Summary: [XSLT 2.0] format-time(): an oddity with fractional seconds
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 2.0 (show other bugs)
Version: Candidate Recommendation
Hardware: PC Windows XP
: 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: 2006-04-27 21:38 UTC by Michael Kay
Modified: 2006-05-03 21:19 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2006-04-27 21:38:56 UTC
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.