// get the iterator over the nodes and check it
String uri = null;
if (hasPrefix) {
uri = support.translateNamespacePrefixToUri(prefix);
if (uri == null) {
throw new UnresolvableException("XPath expression uses unbound namespace prefix " + prefix);
}
}
Iterator axisNodeIter = iterableAxis.namedAccessIterator(
contextNode, support, localName, prefix, uri);
if (axisNodeIter == null || axisNodeIter.hasNext() == false) {
return Collections.EMPTY_LIST;
}
// convert iterator to list for predicate test
// no need to filter as named access guarantees this
List newNodeSet = new ArrayList();
while (axisNodeIter.hasNext()) {
newNodeSet.add(axisNodeIter.next());
}
// evaluate the predicates
return getPredicateSet().evaluatePredicates(newNodeSet, support);
}
else {
// get the iterator over the nodes and check it
Iterator axisNodeIter = iterableAxis.iterator(contextNode, support);
if (axisNodeIter == null || axisNodeIter.hasNext() == false) {
return Collections.EMPTY_LIST;
}
// run through iterator, filtering using matches()
// adding to list for predicate test
List newNodeSet = new ArrayList(contextSize);
while (axisNodeIter.hasNext()) {
Object eachAxisNode = axisNodeIter.next();
if (matches(eachAxisNode, support)) {
newNodeSet.add(eachAxisNode);
}
}
// evaluate the predicates
return getPredicateSet().evaluatePredicates(newNodeSet, support);
}
}
// full case
IdentitySet unique = new IdentitySet();
List interimSet = new ArrayList(contextSize);
List newNodeSet = new ArrayList(contextSize);
if (namedAccess) {
String uri = null;
if (hasPrefix) {
uri = support.translateNamespacePrefixToUri(prefix);
if (uri == null) {
throw new UnresolvableException("XPath expression uses unbound namespace prefix " + prefix);
}
}
for (int i = 0; i < contextSize; ++i) {
Object eachContextNode = contextNodeSet.get(i);