} else if(Type.subTypeOf(item.getType(), Type.NODE)) {
} else if (Type.subTypeOf(item.getType(), Type.STRING)) { String path = item.getStringValue(); try { XmldbURI uri = XmldbURI.xmldbUriFor(path).removeLastSegment(); return new StringValue(uri.toString()); } catch (URISyntaxException e) { throw new XPathException(getASTNode(), "Illegal URI for resource path: " + path); } } else if(Type.subTypeOf(item.getType(), Type.NODE)) {
	public Sequence eval(Sequence[] args, Sequence contextSequence)		throws XPathException {	    if(args[0].isEmpty())	        return Sequence.EMPTY_SEQUENCE;		Item item = args[0].itemAt(0);		if(item.getType() == Type.JAVA_OBJECT) {			Object o = ((JavaObjectValue) item).getObject();            if (!(o instanceof Collection))                throw new XPathException(getASTNode(), "Passed Java object should be of type org.xmldb.api.base.Collection");            Collection collection = (Collection)o;            try {				return new StringValue(collection.getName());			} catch (XMLDBException e) {				throw new XPathException(getASTNode(), "Failed to retrieve collection name", e);			}		} else if(Type.subTypeOf(item.getType(), Type.NODE)) {			NodeValue node = (NodeValue) item;			if(node.getImplementationType() == NodeValue.PERSISTENT_NODE) {				NodeProxy p = (NodeProxy) node;				//TODO: use xmldbUri				return new StringValue(p.getDocument().getCollection().getURI().toString());				}		} else			throw new XPathException(getASTNode(), "First argument to util:collection-name should be either " +				"a Java object of type org.xmldb.api.base.Collection or a node; got: " + 				Type.getTypeName(item.getType()));		return Sequence.EMPTY_SEQUENCE;	}