public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException { if(args[0].getLength() == 0) return Sequence.EMPTY_SEQUENCE; NodeValue val = (NodeValue)args[0]; Node node = val.getNode(); if(node.getNodeType() == Node.ELEMENT_NODE || node.getNodeType() == Node.ATTRIBUTE_NODE) { if(val.getImplementationType() == NodeValue.IN_MEMORY_NODE) return new QNameValue(context, ((NodeImpl)val).getQName()); else return new QNameValue(context, ((org.exist.dom.NodeImpl)node).getQName());
public Sequence eval(Sequence contextSequence, Item contextItem) throws XPathException { Sequence retval = Sequence.EMPTY_SEQUENCE; Node n = null;  if(contextItem != null) contextSequence = contextItem.toSequence(); if(getArgumentCount() > 0) { NodeSet result = getArgument(0).eval(contextSequence).toNodeSet(); if(result.getLength() > 0) n = result.item(0); } else { if(contextSequence.getLength() > 0 && contextSequence.getItemType() == Type.NODE) n = ((NodeSet)contextSequence).item(0);
    public Sequence eval(Sequence[] args, Sequence contextSequence)            throws XPathException {        if(args[0].getLength() == 0)            return Sequence.EMPTY_SEQUENCE;        NodeValue val = (NodeValue)args[0];        Node node = val.getNode();        if(node.getNodeType() == Node.ELEMENT_NODE ||                node.getNodeType() == Node.ATTRIBUTE_NODE) {            if(val.getImplementationType() == NodeValue.IN_MEMORY_NODE)                return new QNameValue(context, ((NodeImpl)val).getQName());            else                return new QNameValue(context, ((org.exist.dom.NodeImpl)node).getQName());        }        return Sequence.EMPTY_SEQUENCE;    }