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 16948 - [FO30] number() when the context item is a list
Summary: [FO30] number() when the context item is a list
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 3.0 (show other bugs)
Version: Proposed Edited Recommendation
Hardware: PC All
: 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: 2012-05-06 20:23 UTC by Michael Kay
Modified: 2012-05-15 16:03 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2012-05-06 20:23:39 UTC
Also applies to the XPath 2.0 functions and operators spec.

It's not clear what happens when number() is called with no arguments, and the context item is a node whose typed value is a list containing more than one atomic value. The spec makes two conflicting statements: on the one hand, it says that number() is equivalent to number(.), in which case a type failure would occur because atomization delivers a value that does not match the required type of xs:anyAtomicType?. On the other hand, it says that if conversion of the context item to a double fails, the function returns NaN.

I think the preferred solution is that number() behaves exactly like number(.), which means there is a possibility of a type error.

Other functions whose argument defaults to the context item do not seem to have the same problem. Some of them do not atomize (for example name(), nilled()); others explicitly work on the string value of the node (normalize-space(), string-length()); while data() allows the result of atomizing to be a sequence.
Comment 1 Michael Kay 2012-05-15 16:03:43 UTC
The WG agreed that number() should behave exactly like number(.).