// node is a member of the nodeset obtained by evaluating the
// equivalent expression
// System.err.println("Testing positional pattern against node " + node.generateId());
XPathContext c2 = context.newMinorContext();
UnfailingIterator single = SingletonIterator.makeIterator(node);
single.next();
c2.setCurrentIterator(single);
try {
SequenceIterator nsv = equivalentExpr.iterate(c2);
while (true) {
NodeInfo n = (NodeInfo) nsv.next();
if (n == null) {
return false;
}
if (n.isSameNodeInfo(node)) {
return true;
}
}
} catch (XPathException e) {
XPathException err = new XPathException("An error occurred matching pattern {" + toString() + "}: ", e);
err.setXPathContext(c2);
err.setErrorCodeQName(e.getErrorCodeQName());
err.setLocator(this);
c2.getController().recoverableError(err);
return false;
}
}
}
if (filters.length != 0) {
XPathContext c2 = context.newMinorContext();
UnfailingIterator iter = SingletonIterator.makeIterator(node);
iter.next();
c2.setCurrentIterator(iter);
// it's a non-positional filter, so we can handle each node separately
for (int i = 0; i < filters.length; i++) {
try {