@@ -8145,7 +8145,7 @@ eval_name_test_with_predicate(const struct lyxp_expr *exp, uint32_t *tok_idx, en
81458145 LY_ERR rc = LY_SUCCESS , r ;
81468146 const char * ncname , * ncname_dict = NULL ;
81478147 uint32_t i , ncname_len ;
8148- const struct lys_module * moveto_mod = NULL ;
8148+ const struct lys_module * moveto_mod = NULL , * moveto_m ;
81498149 const struct lysc_node * scnode = NULL ;
81508150 struct ly_path_predicate * predicates = NULL ;
81518151 int scnode_skip_pred = 0 ;
@@ -8179,8 +8179,15 @@ eval_name_test_with_predicate(const struct lyxp_expr *exp, uint32_t *tok_idx, en
81798179 (set -> type == LYXP_SET_NODE_SET )) {
81808180 /* find the matching schema node in some parent in the context */
81818181 for (i = 0 ; i < set -> used ; ++ i ) {
8182+ if (moveto_mod && (set -> val .nodes [i ].type == LYXP_NODE_ELEM ) &&
8183+ (moveto_mod -> ctx != LYD_CTX (set -> val .nodes [i ].node ))) {
8184+ /* extension data, use the correct module */
8185+ moveto_m = ly_ctx_get_module_implemented (LYD_CTX (set -> val .nodes [i ].node ), moveto_mod -> name );
8186+ } else {
8187+ moveto_m = moveto_mod ;
8188+ }
81828189 if (eval_name_test_with_predicate_get_scnode (set -> ctx , set -> val .nodes [i ].node , ncname , ncname_len ,
8183- moveto_mod , set -> root_type , set -> format , & scnode )) {
8190+ moveto_m , set -> root_type , set -> format , & scnode )) {
81848191 /* check failed */
81858192 scnode = NULL ;
81868193 break ;
0 commit comments