W3C home > Mailing lists > Public > public-qt-comments@w3.org > March 2014

[Bug 25160] [XSLT 3.0] a//c with striding CP is roaming by the rules, though we strove to make it streamable

From: <bugzilla@jessica.w3.org>
Date: Thu, 27 Mar 2014 20:22:02 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-25160-523-6rhtHT770e@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=25160

--- Comment #3 from Michael Kay <mike@saxonica.com> ---
As discussed on the telcon today. section 19.1 of the spec is designed to
address this problem. However, we felt at Prague that 19.1 lacks precision and
should be made more prescriptive.

I think this can be done as follows.

(a) For every *selection pattern* P, there is an implicit *matcher function*
M<P> [angle brackets indicate a subscript]. The matcher function has the
signature M<P>($n as node()) as xs:boolean, and the semantics of the function
are such that M<P>(N) returns true if and only if N is a node that matches the
pattern P.

(b) Definition: A *scanning expression* is an expression E that is the
*equivalent expression* of some *motionless* *selection pattern* P, provided
that E is not a subexpression of some containing expression that is itself a
*scanning expression*, and that the static type of E does not include attribute
or namespace nodes.

Before analyzing a construct C for streamability, but after expansion of
abbreviations such as "//", any *scanning expression* E contained (at any
depth) within C is rewritten as

descendant::node()[M<P>(.)]

where P is the motionless pattern whose *equivalent expression* is E.

For example, descendant::section/child::head is replaced by
descendant::node()[F(.)] where F(N) returns true for nodes that match the
pattern descendant::section/head.

(c) A matcher function taking the context item as its argument is grounded and
motionless.

Note: any expression that meets these criteria is thus evaluated by scanning
all descendant nodes in document order and testing each one to see whether it
matches the corresponding pattern. This execution strategy is streamable,
whereas a nested-loop evaluation strategy that followed the XPath semantics
more closely might not be streamable. Of course, processors are free to adopt a
different algorithm that achieves the same effect and preserves guaranteed
streamability.

Note: the exclusion of patterns that match attributes or namespace nodes is a
simplification that does not adversely affect streamability. It means that
given an expression such as //section/head/@status, which is rewritten as
descendant-or-self::node()/child::section/child::head/attribute::status, the
expression descendant-or-self::node()/child::section/child::head acts as the
*selection expression* to be replaced by a filter expression using a matcher
function; this filter expression is streamable, with crawling posture, and the
addition of an axis step using the attribute or namespace axis then creates an
expression with climbing posture.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Thursday, 27 March 2014 20:22:04 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:46 UTC