[xquery-talk] Find All Nodes Between Root Node and Descendant Nodes of Some Type

Michael Kay mike at saxonica.com
Sun Jul 19 08:31:24 PDT 2015


> On 19 Jul 2015, at 16:12, Eliot Kimber <ekimber at contrext.com> wrote:
> 
> That seems to easy Ken.
> 
> In terms of processing optimization, is there any reason to prefer one
> formulation over the other (meaning, is it possible to predict how XPath
> processors will be able to optimize this type of expression)?
> 

No, it’s not really possible to predict. Both are amenable to optimization, but there’s a law of diminishing returns in what it’s worth attempting. Saxon will do both pretty much as written.

Saxon did at one time attempt to rewrite a/b/c/X except a/b/c/Y as a/b/c/(X except Y) but I found it was unsound, which taught me a lesson. (I forget the actual case that demonstrates this.) I still find it very hard to know how to prove which rewrites are sound and which aren’t.

Michael Kay
Saxonica




More information about the talk mailing list