RE: XQuery Normalization

> 
> There seems to be some curiosity in the normalization of the 
> double slash 
> operator in XPath expressions (XQuery 1.0 and XPath 2.0 
> formal semantics 
> draft), which is normalized as follows:
> 
> ["//" RelativePathExpr]Expr    ==    
> [fn:root( self::node() ) "/" descendant-or-self::node() "/" 
> RelativePathExpr]Expr
> 
> Without any predicates, these expressions, indeed return the 
> expected result. 
> However, when an index is applied after the // operator, for instance:
>     //a[2],
> 
> a problem arises.

This is indeed true, by design, and is the same as XPath 1.0. The result is
only unexpected, of course, if you have the wrong expectations.

Michael Kay

Received on Wednesday, 16 July 2003 12:25:37 UTC