xpath BUGFIX nested extension data nodes node check
diff --git a/src/xpath.c b/src/xpath.c
index 9d3d74d..2b0bcfe 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -5688,9 +5688,9 @@
 
     /* module check */
     if (moveto_mod) {
-        if (!(node->flags & LYD_EXT) && (node->schema->module != moveto_mod)) {
+        if ((set->ctx == LYD_CTX(node)) && (node->schema->module != moveto_mod)) {
             return LY_ENOT;
-        } else if ((node->flags & LYD_EXT) && strcmp(node->schema->module->name, moveto_mod->name)) {
+        } else if ((set->ctx != LYD_CTX(node)) && strcmp(node->schema->module->name, moveto_mod->name)) {
             return LY_ENOT;
         }
     }
@@ -5705,9 +5705,9 @@
 
     /* name check */
     if (node_name) {
-        if (!(node->flags & LYD_EXT) && (node->schema->name != node_name)) {
+        if ((set->ctx == LYD_CTX(node)) && (node->schema->name != node_name)) {
             return LY_ENOT;
-        } else if ((node->flags & LYD_EXT) && strcmp(node->schema->name, node_name)) {
+        } else if ((set->ctx != LYD_CTX(node)) && strcmp(node->schema->name, node_name)) {
             return LY_ENOT;
         }
     }