xpath UPDATE schema xpath support for ext snodes
Refs sysrepo/sysrepo#2945
diff --git a/src/xpath.c b/src/xpath.c
index 08e8110..60862ce 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -6700,6 +6700,17 @@
temp_ctx = 1;
}
}
+
+ if (moveto_mod && ncname && ((axis == LYXP_AXIS_DESCENDANT) || (axis == LYXP_AXIS_CHILD)) &&
+ (set->val.scnodes[i].type == LYXP_NODE_ELEM) && !ly_nested_ext_schema(NULL, set->val.scnodes[i].scnode,
+ moveto_mod->name, strlen(moveto_mod->name), LY_VALUE_JSON, NULL, ncname, strlen(ncname), &iter, NULL)) {
+ /* there is a matching node from an extension, use it */
+ LY_CHECK_RET(set_scnode_insert_node(set, iter, LYXP_NODE_ELEM, axis, &idx));
+ if ((idx < orig_used) && (idx > i)) {
+ set->val.scnodes[idx].in_ctx = LYXP_SET_SCNODE_ATOM_NEW_CTX;
+ temp_ctx = 1;
+ }
+ }
}
/* correct temporary in_ctx values */