protected NodeSet getAncestors(DocumentSet documents, NodeSet context) {
protected NodeSet getAncestors( StaticContext context, DocumentSet documents, NodeSet contextSet) {
	protected NodeSet getAncestors(DocumentSet documents, NodeSet context) {		if (test.getType() == NodeTest.NAME_TEST) {			DBBroker broker = null;			try {				broker = pool.get();				if (buf == null)					buf = (NodeSet) broker.findElementsByTagName(documents, test.getName());				NodeSet r =					context.getAncestors(						(ArraySet) buf,						axis == Constants.ANCESTOR_SELF_AXIS,						inPredicate);				LOG.debug("getAncestors found " + r.getLength());				return r;			} catch (EXistException e) {				LOG.debug(e.getMessage(), e);				return null;			} finally {				pool.release(broker);			}		} else {			NodeSet result = new ArraySet(context.getLength());			NodeProxy p;			for(Iterator i = context.iterator(); i.hasNext(); ) {				p = (NodeProxy)i.next();				if(axis == Constants.ANCESTOR_SELF_AXIS &&					((TypeTest)test).isOfType(p, p.nodeType))					result.add(new NodeProxy(p.doc, p.gid, p.internalAddress));				while((p.gid = XMLUtil.getParentId(p.doc, p.gid)) > 0) {					if(((TypeTest)test).isOfType(p, Node.ELEMENT_NODE))						result.add(new NodeProxy(p.doc, p.gid));				}			}			return result;		}	}