Menu

#633 Saxon-SA incorrect filter optimization

v8.8
closed
5
2012-10-08
2006-12-14
Michael Kay
No

Saxon-SA may carry out an incorrect optimization of certain filtered path expressions. The expressions in question take the form

a/b/c[d=f]

where it is known by static analysis that the context item will be a document node. In such cases Saxon attempts to treat the expression as /a/b/c[d=f], because this enables a rewrite to use a document-level index. However this rewrite is done incorrectly, with the likely consequence that no data will be selected.

Workaround: add a leading "/" to the path expression.

A patch is being placed in Subversion, it affects method isAbsolute in net.sf.saxon.expr.PathExpression. However, the patch will of course only be effective when the patched module is incorporated in a build of Saxon-SA. The effect of this patch is merely to remove the attempt at optimization; the source clearance will make the optimization work properly.

Discussion