Value resultValue = expr.eval( docs, null, null );
Value resultValue = expr.eval( context, docs, null, null );
	protected void processXInclude(Attributes atts) throws SAXException {		// save some settings		DocumentImpl prevDoc = document;		boolean createContainerElements = serializer.createContainerElements;		serializer.createContainerElements = false;				// parse the href attribute		String href = atts.getValue("href");		if(href != null) {			LOG.debug("found href=\"" + href + "\"");			String xpointer = null;			String docName = href;			// try to find xpointer part			int p = href.indexOf('#');			if(-1 < p) {				docName = href.substring(0, p);				xpointer = XMLUtil.decodeAttrMarkup(href.substring(p + 1));				LOG.debug("found xpointer: " + xpointer);			}			// if docName has no collection specified, assume			// current collection 			p = docName.lastIndexOf('/');			if(p < 0)				docName = document.getCollection().getName() + '/' +					docName;			// retrieve the document			LOG.debug("loading " + docName);			DocumentImpl doc = null;			try {				doc =					(DocumentImpl)serializer.broker.getDocument(docName);			} catch (PermissionDeniedException e) {				LOG.warn("permission denied", e);				throw new SAXException(e);			}			/* if document has not been found and xpointer is			 * null, throw an exception. If xpointer != null			 * we retry below and interpret docName as			 * a collection.			 */			if(doc == null && xpointer == null)				throw new SAXException("document " + docName +					" not found");			if(xpointer == null)				// no xpointer found - just serialize the doc				serializer.serializeToSAX( doc, false );			else {				// process the xpointer				try {					// build input document set					DocumentSet docs = null;					if(doc == null) {						// try to read documents from the collection						// specified by docName						docs = 							serializer.broker.getDocumentsByCollection(docName);						// give up						if(docs == null)							throw new SAXException("no document or collection " +								"called " + docName);					} else {						docs = new DocumentSet();						docs.add(doc);					}					XPathLexer lexer = 						new XPathLexer( new StringReader( xpointer ) );					BrokerPool pool = serializer.broker.getBrokerPool();					XPathParser parser = 						new XPathParser( pool, serializer.getUser(), lexer );					PathExpr expr = new PathExpr(pool);					parser.xpointer( expr );					LOG.info( "xpointer query: " + expr.pprint() );					long start = System.currentTimeMillis();					if ( parser.foundErrors() )						throw new SAXException(parser.getErrorMsg());					docs = expr.preselect( docs );					if ( docs.getLength() == 0 )						return;					Value resultValue = expr.eval( docs, null, null );					switch(resultValue.getType()) {						case Value.isNodeList:							NodeSet set = (NodeSet)resultValue.getNodeList();							LOG.info("xpointer found: " + set.getLength());												NodeProxy proxy;							for(Iterator i = set.iterator(); i.hasNext(); ) {								proxy = (NodeProxy)i.next();								serializer.serializeToSAX(proxy, false);							}							break;						default:							ValueSet values = resultValue.getValueSet();							String val;							for(int i = 0; i < values.getLength(); i++) {								val = values.get(i).getStringValue();								characters(val.toCharArray(), 0, val.length());							}							break;					}												} catch (RecognitionException e) {					LOG.warn("xpointer error", e);					throw new SAXException(e);				} catch (TokenStreamException e) {					LOG.warn("xpointer error", e);					throw new SAXException(e);				} catch (PermissionDeniedException e) {					LOG.warn("xpointer error", e);					throw new SAXException(e);				} catch (EXistException e) {					LOG.warn("xpointer error", e);					throw new SAXException(e);				}			}		}		// restore settings		document = prevDoc;		serializer.createContainerElements = createContainerElements;	}