File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
exist-core/src/main/java/org/exist/xquery/functions/fn/transform Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,14 @@ static StringBuilder pathTo(final Node node) {
64
64
static List <Integer > treeIndex (final Node node ) {
65
65
final Node parent = node .getParentNode ();
66
66
if (parent == null ) {
67
- return new ArrayList <>();
67
+ final List <Integer > index = new ArrayList <>();
68
+ // The root element always index 0 within the document node.
69
+ // Some node implementations (e.g., org.exist.dom.memtree.NodeImpl) do not always have an associated document.
70
+ // In this case, the nodeIndex must get an extra 0 index to be valid for xdmDocument.
71
+ if (! (node instanceof Document )) {
72
+ index .add (0 );
73
+ }
74
+ return index ;
68
75
}
69
76
final List <Integer > index = treeIndex (parent );
70
77
Node sibling = node .getPreviousSibling ();
You can’t perform that action at this time.
0 commit comments