int stackFrame,
Expression expr )
throws org.apache.xml.utils.WrappedRuntimeException
{
PrefixResolver savedResolver = xctxt.getNamespaceContext();
XNodeSet result = null;
try
{
xctxt.pushCurrentNode(context);
xctxt.setNamespaceContext(prefixResolver);
// The setRoot operation can take place with a reset operation,
// and so we may not be in the context of LocPathIterator#nextNode,
// so we have to set up the variable context, execute the expression,
// and then restore the variable context.
if (isTopLevel)
{
// System.out.println("calling m_expr.execute(getXPathContext())");
VariableStack vars = xctxt.getVarStack();
// These three statements need to be combined into one operation.
int savedStart = vars.getStackFrame();
vars.setStackFrame(stackFrame);
result = (org.apache.xpath.objects.XNodeSet) expr.execute(xctxt);
result.setShouldCacheNodes(true);
// These two statements need to be combined into one operation.
vars.setStackFrame(savedStart);
}
else