result = (AtomicValue)item.convertTo(requiredType);
result = item.convertTo(requiredType);
	public Sequence eval(Sequence contextSequence, Item contextItem) throws XPathException {                if (context.getProfiler().isEnabled()) {            context.getProfiler().start(this);                   context.getProfiler().message(this, Profiler.DEPENDENCIES, "DEPENDENCIES", Dependency.getDependenciesName(this.getDependencies()));            if (contextSequence != null)                context.getProfiler().message(this, Profiler.START_SEQUENCES, "CONTEXT SEQUENCE", contextSequence);            if (contextItem != null)                context.getProfiler().message(this, Profiler.START_SEQUENCES, "CONTEXT ITEM", contextItem.toSequence());        }                Sequence result;		Sequence seq = expression.eval(contextSequence, contextItem);		if (seq.isEmpty()) {			if ((cardinality & Cardinality.ZERO) == 0)				throw new XPathException(getASTNode(), "Type error: empty sequence is not allowed here");			else                result = Sequence.EMPTY_SEQUENCE;		} else {                    Item item = seq.itemAt(0);            try {                // casting to QName needs special treatment                if(requiredType == Type.QNAME) {                    if (item.getType() == Type.QNAME)                        result = item.toSequence();                    else if(item.getType() == Type.ATOMIC || Type.subTypeOf(item.getType(), Type.STRING)) {                        result = new QNameValue(context, item.getStringValue());                    } else {                        throw new XPathException(getASTNode(), "Cannot cast " + Type.getTypeName(item.getType()) +                                 " to xs:QName");                    }                } else                    result = (AtomicValue)item.convertTo(requiredType);    		} catch(XPathException e) {    			e.setASTNode(getASTNode());    			throw e;    		}                    }        if (context.getProfiler().isEnabled())                       context.getProfiler().end(this, "", result);                return result;         	}