W3C home > Mailing lists > Public > public-qt-comments@w3.org > May 2017

[Bug 30093] [xslt30] Incorrect explanation of example pattern

From: <bugzilla@jessica.w3.org>
Date: Thu, 04 May 2017 17:43:07 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-30093-523-yUfbC2TvHb@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=30093

Michael Kay <mike@saxonica.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #1 from Michael Kay <mike@saxonica.com> ---
The WG agreed the change, and I have changed the explanation of the example to
say "//para matches any para element in a tree that is rooted at a document
node".

The WG also asked the editor, for the record, to provide a technical
explanation of why the example is incorrect.

The relevant rule for the semantics of this pattern is in ยง5.5.3 (The Meaning
of a Pattern) and reads:

an item N matches a pattern P if the following applies, where EE is the
equivalent expression to P: N is a node, and the result of evaluating the
expression root(.)//(EE) with a singleton focus based on N is a sequence that
includes the node N

So //para matches $N if the result of root($N)//(//para) contains N. This
expression expands to

root($N)/
  descendant-or-self::node()/
  ( root(.) treat as document-node()/
    descendant-or-self::node()/
    child::para )

If $X is a root node then for every descendant $D of $X, root($D) will be $X.
So this can be simplified to

root($N) treat as document-node()/
    descendant-or-self::node()/
    child::para

It is clear that 

(a) all nodes selected by this expression are elements named para

(b) in the case of a para for which root(.) is not a document node, the step
(root(.) treat as document node) will fail with a dynamic error, and therefore
the pattern will not match

(c) for every element E in a tree that is rooted at a document node, E is
either a child of the document node, or a child of a descendant of the document
node, and therefore the pattern selects EVERY element named para in such a
tree.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Thursday, 4 May 2017 17:43:14 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 4 May 2017 17:43:14 UTC