LOG.debug("Docs: " + result.getLength());
    public Sequence eval(Sequence contextSequence, Item contextItem) throws XPathException {        // get statically known documents from the context        DocumentSet ds = context.getStaticallyKnownDocuments();        if (ds == null || ds.getLength() == 0) return Sequence.EMPTY_SEQUENCE;                // if the expression occurs in a nested context, we might have cached the        // document set        if (cachedDocs != null && cachedDocs.equals(ds)) return cached;                // check if the loaded documents should remain locked        boolean lockOnLoad = context.lockDocumentsOnLoad();        try {            // wait for pending updates            ds.lock(false);            	        NodeSet result = new ArraySet(ds.getLength());	        DocumentImpl doc;	        for (Iterator i = ds.iterator(); i.hasNext();) {	            doc = (DocumentImpl) i.next();	            if(doc.getResourceType() == DocumentImpl.XML_FILE) {  // skip binary resources	            	result.add(new NodeProxy(doc, -1));	            	if(lockOnLoad) {	            	    context.getLockedDocuments().add(doc);	            	}	            }	        }	        cached = result;	        cachedDocs = ds;            LOG.debug("Docs: " + result.getLength());	        return result;        } catch (LockException e) {            throw new XPathException(getASTNode(), "Failed to acquire lock on the context document set");        } finally {            if(!lockOnLoad)                // release all locks                ds.unlock(false);        }    }