if (ic.isAllowUndeclaredVariables()) {
// self-declaring variables modify the static context. The XPathCompiler must not change state
// as the result of compiling an expression, so we need to copy the static context.
ic = env.copy();
for (Iterator iter = env.iterateExternalVariables(); iter.hasNext();) {
XPathVariable var = (XPathVariable)iter.next();
XPathVariable var2 = ic.declareVariable(var.getVariableQName());
var2.setRequiredType(var.getRequiredType());
}
}
try {
XPathEvaluator eval = new XPathEvaluator(processor.getUnderlyingConfiguration());
eval.setStaticContext(ic);