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 27075 - [xslt3.0ts] Streamability of void path expressions
Summary: [xslt3.0ts] Streamability of void path expressions
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 Test Suite (show other bugs)
Version: Working drafts
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Abel Braaksma
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-16 11:43 UTC by Michael Kay
Modified: 2015-05-06 21:14 UTC (History)
1 user (show)

See Also:


Attachments

Description Michael Kay 2014-10-16 11:43:44 UTC
A number of the new Posture+Sweep tests use void path expressions, for example A030 uses

<xpath>descendant::document-node()/attribute()</xpath>

Rule 3 for streamability of axis steps (19.8.7.7) says:

If the statically-inferred context item type is such that the axis will always be empty (for example, applying the child axis to a text node or the parent axis to a document node), or if the NodeTest is one that can never select nodes on the chosen axis (for example, selecting attribute nodes on the child axis), then the sweep is motionless and the posture is grounded (because the expression is statically known to return an empty sequence);

In this example both axis steps fall under this rule, so they are both Grounded+Motionless, and therefore (under the rules for path expressions in 19.8.7.6) the path expression as a whole is Grounded+Motionless. The expected result of the test case is given as Climbing+Consuming. 

There are other tests where only one of the axis steps is void under this rule, for example

<xpath>descendant-or-self::foo/namespace::attribute()</xpath>

In this case I believe the spec gives the result as Grounded+Consuming, which is reasonable enough. Saxon is smarter, and computes the result as Grounded+Motionless, because it has already worked out that the entire path expression is void. The expected result in the test case, however, is Climbing+Consuming.
Comment 1 Abel Braaksma 2014-10-16 19:57:36 UTC
> descendant::document-node()/attribute()

This appears to be an error in _base-expressions.xml where the descendant::document-node() step expression is classified as able to return document nodes, which obviously it can't:

<production node-type="document">descendant::document-node()</production>


> descendant-or-self::foo/namespace::attribute()

In _base-expressions.xml there appeared to be copy and paste error:

<production node-type="attribute">namespace::attribute()</production>
<production node-type="attribute">namespace::attribute(*)</production>
<production node-type="attribute">namespace::attribute(ex:foo)</production>
<production node-type="attribute">namespace::attribute(Q{http://example.com}foo)</production>

these productions should all be classified as node-type "empty", because they can never select anything.

I fixed the base expressions and reran the generator and the first is now "grounded, motionless" and the second is "grounded, consuming" as per the spec.
Comment 2 Abel Braaksma 2014-10-16 20:17:16 UTC
Fixed in repository.
Comment 3 Abel Braaksma 2015-05-06 21:14:53 UTC
Was resolved > 30 days ago, closing.