Evaluator eval = null;
if (contextNode != null) {
eval = new DefaultEvaluator(fDynamicContext, domDoc);
// change focus to the top most element
ResultSequence nodeEvalRS = ResultSequenceFactory.create_new();
nodeEvalRS.add(new ElementType(contextNode,
fDynamicContext.node_position(contextNode)));
if (xPathDefaultNamespace != null) {
fDynamicContext.add_namespace(null, xPathDefaultNamespace);
}
fDynamicContext.set_focus(new Focus(nodeEvalRS));
}
else {
eval = new DefaultEvaluator(fDynamicContext, null);
}
ResultSequence rs = eval.evaluate(xp);
boolean result = false;
if (rs == null) {
result = false;
} else {
if (rs.size() == 1) {
AnyType rsReturn = rs.get(0);
if (rsReturn instanceof XSBoolean) {
XSBoolean returnResultBool = (XSBoolean) rsReturn;
result = returnResultBool.value();
} else {
result = false;