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 30033 - [xslt30] Streamability rules for fn:current() lack an "otherwise" clause
Summary: [xslt30] Streamability rules for fn:current() lack an "otherwise" clause
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Candidate 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: 2016-12-15 12:58 UTC by Michael Kay
Modified: 2017-01-05 22:10 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2016-12-15 12:58:46 UTC
In section 19.8.9.3, Streamability of the current() function, there's no statement as to what the outcome is if none of the conditions in rules 1, 2, or 3 apply.
Comment 1 Michael Kay 2016-12-15 14:43:06 UTC
Note also that rule (1) talks of the outermost containing XPath expression, which doesn't really allow for use of current() within a pattern.

Test case stream-200 (in test set source-document) uses the following within a streamable accumulator:

match="part-name/text()[$selected-parts = current()]"

To establish that this is streamable, we need to establish that the static type of current() is a text node. There is nothing in the static typing rules to achieve this. We can make it guaranteed-streamable by writing it as

match="part-name/text()[$selected-parts = current() treat as text()]"

but this seems a little unfortunate.
Comment 2 Michael Kay 2016-12-16 10:44:17 UTC
Proposed resolution:

Explanations in "[]", which may become notes in the spec if appropriate.

(1) Add special rules for the static type of a call to current():

(a) if the call is within an XPath expression, the *context item type* that applies to the outermost containing XPath expression, determined by the rules in 19.2.

(b) if the call is within a pattern, the *match type* of the pattern, as defined in 19.2. [Note: a call to current() in a pattern will always be within a predicate, which means that the match type of the pattern will never depend on the static type of the call to current(), so there is no circularity in this definition].

In 19.8.9.3, Streamability of fn:current(), change the rules to (§§ marks changes):

The sweep and posture of a call to the current function are determined as follows:

§§1. If the call appears within a pattern [Note: it will always be within a predicate of the pattern], then climbing and motionless.

2. Otherwise, let E be the outermost containing XPath expression of the call to the current function.

2(a) If the context posture of E is grounded, then motionless and grounded.

2(b) If the path in the expression tree that connects the call on current to E (excluding E itself) contains an expression that is a higher-order operand of its parent expression, then climbing and motionless.

§§2(c) Otherwise, the posture is the context posture, and the sweep is motionless.
Comment 3 Michael Kay 2017-01-05 22:10:48 UTC
The changes were agreed and have been applied.