Spurious error optimising void filter expression
The Saxon-EE optimizer may produce a spurious static error when optimising a filter expression of the form
in the case where $x is statically known to be an empty sequence. The error message is:
Leading '/' cannot select the root node of the tree containing the context item
The cause of the error is that the static type of $x is computed as xs:error, and xs:error is a subtype of document-node(), so the optimizer decides that $x is a document node, and therefore the filter expression can be converted to a call on key() with a system-generated key definition.
A patch is being committed on the 9.5 and 9.6 branches.