Sequence nodes = arg0.eval(context, docs, contextSequence); String result = nodes.getStringValue();
String result = seq.getStringValue();
	public Sequence eval(StaticContext context, DocumentSet docs, Sequence contextSequence, 		Item contextItem) throws XPathException {		if(getArgumentCount() < 2)			throw new XPathException("substring requires at least two arguments");		Expression arg0 = getArgument(0);		Expression arg1 = getArgument(1);		Expression arg2 = null;		if(getArgumentCount() > 2)			arg2 = getArgument(2);		if(contextItem != null)			contextSequence = contextItem.toSequence();		int start = ((NumericValue)arg1.eval(context, docs, contextSequence).convertTo(Type.INTEGER)).getInt();		int length = 1;		if(arg2 != null)			length = ((NumericValue)arg2.eval(context, docs, contextSequence).convertTo(Type.INTEGER)).getInt();		if(start <= 0 || length < 0)			throw new IllegalArgumentException("Illegal start or length argument");		Sequence nodes = arg0.eval(context, docs, contextSequence);		String result = nodes.getStringValue();		if(start < 0 || --start + length >= result.length())			return new StringValue("");		return new StringValue((length > 0) ? result.substring(start, start + length) : result.substring(start));	}