Sequence result; Item item = null;   if(getArgumentCount() > 0) { Sequence seq = getArgument(0).eval(contextSequence); if(!seq.isEmpty()) item = seq.itemAt(0); } else { if(!contextSequence.isEmpty()) item = contextSequence.itemAt(0); } if(item == null) result = Sequence.EMPTY_SEQUENCE; else { if(!Type.subTypeOf(item.getType(), Type.NODE)) throw new XPathException(getASTNode(), getName() + " expects an argument of type node(); got: " + Type.getTypeName(item.getType()));
if (getSignature().getArgumentCount() > 0) seq = getArgument(0).eval(contextSequence, contextItem);  else seq = contextSequence;  result = new ValueSequence(); int j = 0; for (SequenceIterator i = seq.toNodeSet().iterate(); i.hasNext(); j++) { item = i.nextItem(); if (!Type.subTypeOf(item.getType(), Type.NODE)) throw new XPathException("FOTY0011: item is not a node; got '" + item + "'");
	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());        }        		if(contextItem != null)			contextSequence = contextItem.toSequence();                Sequence result;        Item item = null;        // check if the node is passed as an argument or should be taken from        // the context sequence		if(getArgumentCount() > 0) {			Sequence seq = getArgument(0).eval(contextSequence);			if(!seq.isEmpty())				item = seq.itemAt(0);		} else {			if(!contextSequence.isEmpty())				item = contextSequence.itemAt(0);		}        if(item == null)            result = Sequence.EMPTY_SEQUENCE;        else {            if(!Type.subTypeOf(item.getType(), Type.NODE))                throw new XPathException(getASTNode(), getName() + " expects an argument of type node(); got: " +                        Type.getTypeName(item.getType()));                        Node n = ((NodeValue)item).getNode();    		switch(n.getNodeType()) {    			case Node.ELEMENT_NODE:    			case Node.ATTRIBUTE_NODE:    				result = new StringValue(n.getNodeName());    				break;    			case Node.PROCESSING_INSTRUCTION_NODE:    				result = new StringValue(((ProcessingInstruction)n).getTarget());                    break;                //TODO : what kind of default do we expect here ? -pb    			default:    				return new StringValue("");    		}        }                if (context.getProfiler().isEnabled())             context.getProfiler().end(this, "", result);                 return result;                  	}