if (buf == null) { buf =
DocumentSet docs = contextSet.getDocumentSet(); if (currentDocs == null || !(docs.equals(currentDocs))) { currentDocs = docs; currentSet =
	protected NodeSet getAncestors(		StaticContext context,		NodeSet contextSet) {		if (!test.isWildcardTest()) {			if (buf == null) {				buf =					(NodeSet) context.getBroker().findElementsByTagName(						ElementValue.ELEMENT, contextSet.getDocumentSet(),						test.getName());			}			NodeSet r =				contextSet.selectAncestors(					buf,					axis == Constants.ANCESTOR_SELF_AXIS,					inPredicate);			//LOG.debug("getAncestors found " + r.getLength());			return r;		} else {			NodeSet result = new ExtArrayNodeSet();			NodeProxy p;			for (Iterator i = contextSet.iterator(); i.hasNext();) {				p = (NodeProxy) i.next();				if (axis == Constants.ANCESTOR_SELF_AXIS && test.matches(p))					result.add(						new NodeProxy(p.doc, p.gid, p.getInternalAddress()));				while ((p.gid = XMLUtil.getParentId(p.doc, p.gid)) > 0) {					p.nodeType = Node.ELEMENT_NODE;					if (test.matches(p))						result.add(new NodeProxy(p.doc, p.gid));				}			}			return result;		}	}