data tree BUGFIX keep first sibling pointer correct
In case it is supposed to point to the first data sibling
of a module, do not break this.
diff --git a/src/xpath.c b/src/xpath.c
index 1fd0e9d..35c29f4 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -8470,6 +8470,14 @@
return LY_EINVAL;
}
+ if (tree) {
+ /* adjust the pointer to be the first top-level sibling */
+ while (tree->parent) {
+ tree = lyd_parent(tree);
+ }
+ tree = lyd_first_sibling(tree);
+ }
+
/* prepare set for evaluation */
memset(set, 0, sizeof *set);
set->type = LYXP_SET_NODE_SET;