RE: ORA-XQ-281-B: please permit // on element nodes

> SECTION 3.2: Path expressions
> 
> It says that "//" at the beginning of a path expression is an 
> abbreviation for fn:root(self::node()) treat as 
> document-node()/ descendent-or-self::node().  As noted, this 
> will cause an exception if the root is not a document node.  
> This seems arbitrary.  Why not permit // when the root of a 
> node is just an element node, 
> for example?
> 
The reason we made this decision is that users expect //A to select all
the A elements in a tree; but if the root of the tree is an A element,
then /descendant-or-self::node()/A would not select that A element.
Similarly, it would not be selected by the expression /A (which means
/child::A). Since we couldn't come up with a semantics for /A and //A
for trees rooted an element node that would be both intuitive and
logical, we decided not to allow it. You haven't said what you think the
semantics should be.

Michael Kay

Received on Monday, 16 February 2004 18:02:16 UTC