whereExpr = null;
	public Sequence eval(		DocumentSet docs,		Sequence contextSequence,		Item contextItem)		throws XPathException {		Sequence result = null;		context.pushLocalContext(false);		// declare the variable		Variable var = new Variable(QName.parse(context, varName));		context.declareVariable(var);				// declare positional variable		Variable at = null;		if(positionalVariable != null) {			at = new Variable(QName.parse(context, positionalVariable));			context.declareVariable(at);		}				// evaluate the "in" expression		Sequence in = inputSequence.eval(docs, null, null);		var.setValue(in);		if(whereExpr != null)			whereExpr.setInPredicate(true);		if(whereExpr != null && 			( whereExpr.getDependencies() & Dependency.CONTEXT_ITEM ) == 0 &&			at == null) {			LOG.debug("using single walk-through");			setContext(in);			in = applyWhereExpression(context, docs, null);			whereExpr = null;		}				if(orderSpecs != null)			result = 				new OrderedValueSequence(docs, orderSpecs, in.getLength());		else			result = new ValueSequence();					Sequence val = null;		int p = 1;		IntegerValue atVal = new IntegerValue(1);		if(positionalVariable != null)			at.setValue(atVal);		// loop through each variable binding		for (SequenceIterator i = in.iterate(); i.hasNext(); p++) {			contextItem = i.nextItem();			context.setContextPosition(p);			atVal.setValue(p);						if(contextItem instanceof NodeProxy)				((NodeProxy)contextItem).addContextNode((NodeProxy)contextItem);			contextSequence = contextItem.toSequence();			// set variable value to current item			var.setValue(contextSequence);			// check optional where clause			if (whereExpr != null) {				val = applyWhereExpression(context, docs, contextSequence);				if(!val.effectiveBooleanValue())					continue;			} else				val = contextItem.toSequence();						// if there is no "order by" clause, immediately call			// the return clause			if(orderSpecs == null)				val = returnExpr.eval(docs, val);			result.addAll(val);		}		if(orderSpecs != null) {			// sort the result and call return for every item			((OrderedValueSequence)result).sort();			Sequence orderedResult = new ValueSequence();			p = 1;			for(SequenceIterator i = result.iterate(); i.hasNext(); p++) {				contextItem = i.nextItem();				contextSequence = contextItem.toSequence();				// set variable value to current item				var.setValue(contextSequence);				context.setContextPosition(p);				val = returnExpr.eval(docs, contextSequence);				orderedResult.addAll(val);			}			result = orderedResult;		}		context.popLocalContext();		return result;	}