Skip to content

Commit b948018

Browse files
committed
[bugfix] Should check for all Node types
1 parent 18be536 commit b948018

File tree

1 file changed

+2
-4
lines changed
  • exist-core/src/main/java/org/exist/xquery/functions/fn

1 file changed

+2
-4
lines changed

exist-core/src/main/java/org/exist/xquery/functions/fn/FunPath.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ public Sequence eval(final Sequence[] args, final Sequence contextSequence) thro
7878
if (item.getType() == Type.DOCUMENT) {
7979
// If $arg is a document node, the function returns the string "/".
8080
result = new StringValue("/");
81-
} else if (item.getType() == Type.ELEMENT ||
82-
item.getType() == Type.ATTRIBUTE ||
83-
item.getType() == Type.TEXT ) {
81+
} else if (Type.subTypeOf(item.getType(), Type.NODE)) {
8482
// For an element node, Q{uri}local[position], where uri is the
8583
// namespace URI of the node name or the empty string if the
8684
// node is in no namespace, local is the local part of the node
@@ -103,7 +101,7 @@ public Sequence eval(final Sequence[] args, final Sequence contextSequence) thro
103101
}
104102
} else {
105103
// If the context item is not a node, type error [err:XPTY0004].
106-
throw new XPathException(this, ErrorCodes.XPTY0004, "Item is not a document or node; got '" + item + "'", sequence);
104+
throw new XPathException(this, ErrorCodes.XPTY0004, "Item is not a document or node; got '" + Type.getTypeName(item.getType()) + "'", sequence);
107105
}
108106
}
109107
return result;

0 commit comments

Comments
 (0)