xpath UPDATE print context node for xpath warnings
diff --git a/src/xpath.c b/src/xpath.c
index 2c77d01..88c9163 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -3302,6 +3302,27 @@
 }
 
 /**
+ * @brief Print warning with information about the XPath subexpression that caused previous warning.
+ *
+ * @param[in] ctx Context for logging.
+ * @param[in] tok_pos Index of the subexpression in the whole expression.
+ * @param[in] subexpr Subexpression start.
+ * @param[in] subexpr_len Length of @p subexpr to print.
+ * @param[in] cur_scnode Expression context node.
+ */
+static void
+warn_subexpr_log(const struct ly_ctx *ctx, uint16_t tok_pos, const char *subexpr, int subexpr_len,
+        const struct lysc_node *cur_scnode)
+{
+    char *path;
+
+    path = lysc_path(cur_scnode, LYSC_PATH_LOG, NULL, 0);
+    LOGWRN(ctx, "Previous warning generated by XPath subexpression[%" PRIu16 "] \"%.*s\" with context node \"%s\".",
+            tok_pos, subexpr_len, subexpr, path);
+    free(path);
+}
+
+/**
  * @brief Check both operands of comparison operators.
  *
  * @param[in] ctx Context for errors.
@@ -3312,7 +3333,8 @@
  * @param[in] tok_pos Token position.
  */
 static void
-warn_operands(struct ly_ctx *ctx, struct lyxp_set *set1, struct lyxp_set *set2, ly_bool numbers_only, const char *expr, uint16_t tok_pos)
+warn_operands(struct ly_ctx *ctx, struct lyxp_set *set1, struct lyxp_set *set2, ly_bool numbers_only, const char *expr,
+        uint16_t tok_pos)
 {
     struct lysc_node_leaf *node1, *node2;
     ly_bool leaves = 1, warning = 0;
@@ -3358,7 +3380,7 @@
     }
 
     if (warning) {
-        LOGWRN(ctx, "Previous warning generated by XPath subexpression[%u] \"%.20s\".", tok_pos, expr + tok_pos);
+        warn_subexpr_log(ctx, tok_pos, expr + tok_pos, 20, set1->cur_scnode);
     }
 }
 
@@ -3398,9 +3420,9 @@
         if ((((struct lysc_node_leaf *)scnode)->type->basetype == LY_TYPE_IDENT) && !strchr(value, ':')) {
             LOGWRN(set->ctx, "Identityref \"%s\" comparison with identity \"%s\" without prefix, consider adding"
                     " a prefix or best using \"derived-from(-or-self)()\" functions.", scnode->name, value);
-            LOGWRN(set->ctx, "Previous warning generated by XPath subexpression[%u] \"%.*s\".", exp->tok_pos[equal_exp],
+            warn_subexpr_log(set->ctx, exp->tok_pos[equal_exp], exp->expr + exp->tok_pos[equal_exp],
                     (exp->tok_pos[last_equal_exp] - exp->tok_pos[equal_exp]) + exp->tok_len[last_equal_exp],
-                    exp->expr + exp->tok_pos[equal_exp]);
+                    set->cur_scnode);
         }
 
         type = ((struct lysc_node_leaf *)scnode)->type;
@@ -3418,9 +3440,9 @@
                 LOGWRN(set->ctx, "Invalid value \"%s\" which does not fit the type.", value);
             }
             if (rc != LY_SUCCESS) {
-                LOGWRN(set->ctx, "Previous warning generated by XPath subexpression[%u] \"%.*s\".", exp->tok_pos[equal_exp],
+                warn_subexpr_log(set->ctx, exp->tok_pos[equal_exp], exp->expr + exp->tok_pos[equal_exp],
                         (exp->tok_pos[last_equal_exp] - exp->tok_pos[equal_exp]) + exp->tok_len[last_equal_exp],
-                        exp->expr + exp->tok_pos[equal_exp]);
+                        set->cur_scnode);
             } else {
                 type->plugin->free(set->ctx, &storage);
             }