A NullPointerException occurs at compile time when
processing an expression of the form //d[$var] or
Saxon attempts to rewrite such the expression c//d[E]
as c/descendant[E], provided the filter expression E
cannot be numeric. However, if the filter expression is
a variable reference $var, then this rewrite cannot be
done until type information has been analyzed. The
rewrite is being done too early, hence the
Test case added: posn97
Source code fixed. The rewrite has been moved from the
context-indepentent simplify() phase to the
context-dependent typeCheck() phase.
Affects Saxon 7.4 only.