libyang REFACTOR general cast cleanup
diff --git a/src/xpath.c b/src/xpath.c
index b08e47b..b3302b2 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -3703,8 +3703,8 @@
             oper = (sleaf->flags & LYS_IS_OUTPUT) ? LY_PATH_OPER_OUTPUT : LY_PATH_OPER_INPUT;
 
             /* it was already evaluated on schema, it must succeed */
-            rc = ly_path_compile(set->ctx, lref->cur_mod, (struct lysc_node *)sleaf, lref->path,
-                    LY_PATH_LREF_TRUE, oper, LY_PATH_TARGET_MANY, LY_PREF_SCHEMA_RESOLVED, lref->prefixes, NULL, &p);
+            rc = ly_path_compile(set->ctx, lref->cur_mod, &sleaf->node, lref->path, LY_PATH_LREF_TRUE, oper,
+                    LY_PATH_TARGET_MANY, LY_PREF_SCHEMA_RESOLVED, lref->prefixes, NULL, &p);
             assert(!rc);
 
             /* get the target node */