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 24501 - In General streamability, the maximum cardinality rule is ambiguous
Summary: In General streamability, the maximum cardinality rule is ambiguous
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Last Call drafts
Hardware: PC Windows NT
: 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: 2014-02-05 03:02 UTC by Abel Braaksma
Modified: 2014-02-14 17:35 UTC (History)
3 users (show)

See Also:


Attachments

Description Abel Braaksma 2014-02-05 03:02:28 UTC
Under 19.8.1 General Rules for Streamability (http://www.w3.org/TR/xslt-30/#general-streamability-rules), item 2.d.iii, we say the following:

"If the posture of o is crawling and C is a function call of a function whose signature indicates a return type with a maximum cardinality of one (for example a call on head or exactly-one), then striding and the adjusted sweep of o."

This rule can only be applicable to built-in functions, or potentially extension functions of which the processor knows how they can be applied. For stylesheet functions, passing a node to a function without atomizing it is not allowed.

I think it is best if we simply list the group of "functions with cardinality one" to avoid confusion.
Comment 1 Innovimax 2014-02-05 08:27:13 UTC
function of maximum cardinality of one are function for which each call to ($x1, $x2, ...$xn) satisfies zero-or-one(f($x1, $x2, ...,$xn))
Comment 2 Michael Kay 2014-02-05 11:18:56 UTC
I think the rules do work as written, though the reason why is quite subtle. If a call to a user-defined function allows nodes, then the argument that allows nodes will have a type-determined usage of navigation; under 1(b)(iii)(B) in the GSR it will therefore have an adjusted sweep of free-ranging. Rule 2(b) therefore applies and takes precedence over 2(d)(iii).

I would not be averse to a note in 2(d)(iii) that points this out.
Comment 3 Abel Braaksma 2014-02-11 14:12:32 UTC
We probably need to apply this rule to both a function call and a dynamic function call, or does "function call" already entails dynamic function calls? Not sure about production rules here.
Comment 4 C. M. Sperberg-McQueen 2014-02-11 14:48:17 UTC
We discussed this in Prague.

The functions with arguments of usage = transmission that fall under the rule in 2(d)(iii) are:  exactly-one(), head(), zero-or-one().  (Others are transmissional but have cardinality gt 1.)  There was resistance to listing these in normative prose, but a note saying something like "at the time this spec was first published, the functions in question were: ..." would be OK.

It might also be helpful to be more explicit about invariants known to be true when 2(d)(iii) applies:  

- We know we're talking about a built-in or extension function, and not a stylesheet function (stylesheet function arguments have type determined usage and don't reach this point).

- We know that the operand usage is transmission.

- We know it's not a dynamic function call but a static one.
Comment 5 Michael Kay 2014-02-14 17:35:40 UTC
I have added a note explaining that these are the only three functions to which this rule applies (at present), and explaining why.