When an XSLT pattern of the form
is used (specifically, a pattern containing the operator "//" in which the first operand of "//" uses a predicate), and the predicate declares a local variable (in a for/some/every expression, either explicitly or as a result of an optimizer rewrite), then no stckframe slot is allocated to the local variable and in consequence, evaluation of the pattern fails with the exception
The problem is most likely to arise with a pattern of the form
a[@x = 'value']//b
in the case where Saxon does not know that @x will be untyped. In this case Saxon rewrites the predicate as "some $x in data(@x) satisfies $x eq 'value'". This rewrite does not happen when running Saxon-B from the command line because in that case the input is known to be untyped.
A patch to module LocationPathPattern is being placed in Subversion.