if (temp == null) { if (Expression.NO_CONTEXT_ID != contextId) ancestor.addContextNode(contextId, descendant); else ancestor.copyContext(descendant); result.add(ancestor); } else if (Expression.NO_CONTEXT_ID != contextId) temp.addContextNode(contextId, descendant); } } } return result; }
if (temp == null) { if (Expression.IGNORE_CONTEXT != contextId) { if (Expression.NO_CONTEXT_ID != contextId) ancestor.addContextNode(contextId, descendant); else ancestor.copyContext(descendant); } result.add(ancestor); } else if (Expression.NO_CONTEXT_ID != contextId) temp.addContextNode(contextId, descendant); } } } return result; }
    public static NodeSet selectAncestors(NodeSet al, NodeSet dl, boolean includeSelf, int contextId) {		 		NodeSet result = new ExtArrayNodeSet();				for (Iterator i = dl.iterator(); i.hasNext();) {            NodeProxy descendant = (NodeProxy) i.next();            NodeSet ancestors = ancestorsForChild(al, descendant, false, includeSelf, NodeProxy.UNKNOWN_NODE_LEVEL);			for(Iterator j = ancestors.iterator(); j.hasNext(); ) {                NodeProxy ancestor = (NodeProxy) j.next();				if (ancestor != null) {                    NodeProxy temp = result.get(ancestor);					if (temp == null) {						if (Expression.NO_CONTEXT_ID != contextId)                            ancestor.addContextNode(contextId, descendant);						else                            ancestor.copyContext(descendant);						result.add(ancestor);					} else if (Expression.NO_CONTEXT_ID != contextId)						temp.addContextNode(contextId, descendant);				}			}		}		return result;	}