schema tree NEW lys_xpath_node function

Also some functions renamed and documentation
updated.
diff --git a/src/libyang.h b/src/libyang.h
index a9cfd2f..06e83a0 100644
--- a/src/libyang.h
+++ b/src/libyang.h
@@ -386,8 +386,8 @@
  *
  * Functions List (not assigned to above subsections)
  * --------------------------------------------------
- * - lyd_get_node()
- * - lyd_get_node2()
+ * - lyd_xpath_node()
+ * - lyd_find_node()
  */
 
 /**
@@ -569,8 +569,8 @@
  *
  * Internally, XPath evaluation is performed on \b when and \b must conditions in the schema. For that almost
  * a full XPath 1.0 evaluator was implemented. This XPath implementation is available on data trees by calling
- * lyd_get_node() except that only node sets are returned. This XPath conforms to the YANG specification
- * (RFC 6020 section 6.4). Some useful examples:
+ * lyd_xpath_node() and on schema trees by calling lys_xpath_node() except that only node sets are returned.
+ * This XPath conforms to the YANG specification (RFC 6020 section 6.4). Some useful examples:
  *
  * - get all top-level nodes of the __module-name__
  *
@@ -622,7 +622,8 @@
  *
  * Functions List
  * --------------
- * - lyd_get_node()
+ * - lyd_xpath_node()
+ * - lys_xpath_node()
  * - lyd_new_path()
  * - ly_ctx_get_node()
  * - ly_ctx_get_node2()
diff --git a/src/tree_data.c b/src/tree_data.c
index 34bff51..9039900 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -3604,7 +3604,7 @@
             if ((iter->schema->nodetype & (LYS_LEAF | LYS_LEAFLIST)) && iter->schema->child) {
                 set = (struct ly_set *)iter->schema->child;
                 for (i = 0; i < set->number; i++) {
-                    data = lyd_get_node2(iter, set->set.s[i]);
+                    data = lyd_find_node(iter, set->set.s[i]);
                     if (data) {
                         for (j = 0; j < data->number; j++) {
                             if (((struct lyd_node_leaf_list *)data->set.d[j])->value.leafref == iter) {
@@ -4092,7 +4092,7 @@
         case LYS_CONTAINER:
             if (last) {
                 /* find instance in the data */
-                r = lyd_get_node(last, parent->name);
+                r = lyd_xpath_node(last, parent->name);
                 if (!r || r->number > 1) {
                     ly_set_free(r);
                     LOGINT;
@@ -4393,7 +4393,7 @@
 }
 
 API struct ly_set *
-lyd_get_node(const struct lyd_node *data, const char *expr)
+lyd_xpath_node(const struct lyd_node *data, const char *expr)
 {
     struct lyxp_set xp_set;
     struct ly_set *set;
@@ -4434,7 +4434,7 @@
 }
 
 API struct ly_set *
-lyd_get_node2(const struct lyd_node *data, const struct lys_node *schema)
+lyd_find_node(const struct lyd_node *data, const struct lys_node *schema)
 {
     struct ly_set *ret, *ret_aux, *spath;
     const struct lys_node *siter;
diff --git a/src/tree_data.h b/src/tree_data.h
index 9f76db1..f913834 100644
--- a/src/tree_data.h
+++ b/src/tree_data.h
@@ -785,20 +785,19 @@
 /**
  * @brief Search in the given data for instances of nodes matching the provided XPath expression.
  *
- * The \p data is used to find the data root and function then searches in the whole tree and all sibling trees.
  * The XPath expression is evaluated on data -> skip all non-data nodes (input, output, choice, case).
  *
  * Expr examples:
  *      "/ietf-yang-library:modules-state/module[name = 'ietf-yang-library']/namespace"
  *      "/ietf-netconf:get-config/source"
  *
- * @param[in] data Node in the data tree considered the context node. If the node is a configuration one,
- * any state nodes in its tree are not accessible!
+ * @param[in] data Node in the data tree considered the context node if \p expr is relative,
+ * otherwise any node.
  * @param[in] expr XPath expression filtering the matching nodes.
- * @return Set of found data nodes (use dset member of ::ly_set). If no nodes are matching \p expr or the result
+ * @return Set of found data nodes. If no nodes are matching \p expr or the result
  * would be a number, a string, or a boolean, the returned set is empty. In case of an error, NULL is returned.
  */
-struct ly_set *lyd_get_node(const struct lyd_node *data, const char *expr);
+struct ly_set *lyd_xpath_node(const struct lyd_node *data, const char *expr);
 
 /**
  * @brief Search in the given data for instances of the provided schema node.
@@ -807,10 +806,10 @@
  *
  * @param[in] data A node in the data tree to search.
  * @param[in] schema Schema node of the data nodes caller want to find.
- * @return Set of found data nodes (use dset member of ::ly_set). If no data node is found, the returned set is empty.
+ * @return Set of found data nodes. If no data node is found, the returned set is empty.
  * In case of error, NULL is returned.
  */
-struct ly_set *lyd_get_node2(const struct lyd_node *data, const struct lys_node *schema);
+struct ly_set *lyd_find_node(const struct lyd_node *data, const struct lys_node *schema);
 
 /**
  * @brief Get the first sibling of the given node.
diff --git a/src/tree_schema.c b/src/tree_schema.c
index 8adefb9..bb010b5 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -2865,6 +2865,52 @@
 #endif
 
 API struct ly_set *
+lys_xpath_node(const struct lys_node *node, const char *expr)
+{
+    struct lyxp_set set;
+    struct ly_set *ret_set;
+    uint32_t i;
+
+    if (!node || !expr) {
+        ly_errno = LY_EINVAL;
+        return NULL;
+    }
+
+    memset(&set, 0, sizeof set);
+
+    /* node and nodetype won't matter at all since it is absolute */
+    if (lyxp_atomize(expr, node, LYXP_NODE_ELEM, &set, LYXP_SNODE)) {
+        free(set.val.snodes);
+        return NULL;
+    }
+
+    ret_set = ly_set_new();
+
+    for (i = 0; i < set.used; ++i) {
+        if (!set.val.snodes[i].in_ctx) {
+            continue;
+        }
+        assert(set.val.snodes[i].in_ctx == 1);
+
+        switch (set.val.snodes[i].type) {
+        case LYXP_NODE_ELEM:
+            if (ly_set_add(ret_set, set.val.snodes[i].snode, LY_SET_OPT_USEASLIST) == -1) {
+                ly_set_free(ret_set);
+                free(set.val.snodes);
+                return NULL;
+            }
+            break;
+        default:
+            /* ignore roots, text and attr should not ever appear */
+            break;
+        }
+    }
+
+    free(set.val.snodes);
+    return ret_set;
+}
+
+API struct ly_set *
 lys_xpath_atomize(const struct lys_node *cur_snode, enum lyxp_node_type cur_snode_type, const char *expr, int options)
 {
     struct lyxp_set set;
diff --git a/src/tree_schema.h b/src/tree_schema.h
index 2d29f0e..4d0ff64 100644
--- a/src/tree_schema.h
+++ b/src/tree_schema.h
@@ -1567,6 +1567,16 @@
 #define LYS_GETNEXT_INTONPCONT   0x40 /**< lys_getnext() option to look into non-presence container, instead of returning container itself */
 
 /**
+ * @brief Search for schema nodes matching the provided XPath expression.
+ *
+ * @param[in] node Context schema node if \p expr is relative, otherwise any node.
+ * @param[in] expr XPath expression filtering the matching nodes.
+ * @return Set of found schema nodes. If no nodes are matching \p expr or the result
+ * would be a number, a string, or a boolean, the returned set is empty. In case of an error, NULL is returned.
+ */
+struct ly_set *lys_xpath_node(const struct lys_node *node, const char *expr);
+
+/**
  * @brief Types of context nodes, roots other than #LYXP_NODE_ROOT_ALL used only in when conditions.
  */
 enum lyxp_node_type {
diff --git a/tests/api/test_tree_data.c b/tests/api/test_tree_data.c
index e1ba44e..a46e959 100644
--- a/tests/api/test_tree_data.c
+++ b/tests/api/test_tree_data.c
@@ -802,13 +802,13 @@
 }
 
 static void
-test_lyd_get_node(void **state)
+test_lyd_xpath_node(void **state)
 {
     (void) state; /* unused */
     struct ly_set *set = NULL;
     struct lyd_node_leaf_list *result;
 
-    set = lyd_get_node(root->child, "/a:x/bubba");
+    set = lyd_xpath_node(root->child, "/a:x/bubba");
 
     struct lyd_node *node = *set->set.d;
     result = (struct lyd_node_leaf_list *) node;
@@ -818,13 +818,13 @@
 }
 
 static void
-test_lyd_get_node_2(void **state)
+test_lyd_find_node(void **state)
 {
     (void) state; /* unused */
     struct ly_set *set = NULL;
     struct lyd_node_leaf_list *result;
 
-    set = lyd_get_node2(root->child, root->child->schema);
+    set = lyd_find_node(root->child, root->child->schema);
     if (!set) {
         fail();
     }
@@ -1480,8 +1480,8 @@
         cmocka_unit_test_setup_teardown(test_lyd_insert_before, setup_f, teardown_f),
         cmocka_unit_test_setup_teardown(test_lyd_insert_after, setup_f, teardown_f),
         cmocka_unit_test_setup_teardown(test_lyd_schema_sort, setup_f, teardown_f),
-        cmocka_unit_test_setup_teardown(test_lyd_get_node, setup_f, teardown_f),
-        cmocka_unit_test_setup_teardown(test_lyd_get_node_2, setup_f, teardown_f),
+        cmocka_unit_test_setup_teardown(test_lyd_xpath_node, setup_f, teardown_f),
+        cmocka_unit_test_setup_teardown(test_lyd_find_node, setup_f, teardown_f),
         cmocka_unit_test_setup_teardown(test_lyd_validate_leafref, setup_leafrefs, teardown_f),
         cmocka_unit_test_setup_teardown(test_lyd_validate, setup_f, teardown_f),
         cmocka_unit_test_setup_teardown(test_lyd_unlink, setup_f, teardown_f),
diff --git a/tests/api/test_xpath.c b/tests/api/test_xpath.c
index 408801f..80e694b 100644
--- a/tests/api/test_xpath.c
+++ b/tests/api/test_xpath.c
@@ -193,15 +193,15 @@
 {
     struct state *st = (*state);
 
-    st->set = lyd_get_node(st->dt, "/:interface/name");
+    st->set = lyd_xpath_node(st->dt, "/:interface/name");
     assert_ptr_equal(st->set, NULL);
     assert_int_not_equal(ly_errno, 0);
 
-    st->set = lyd_get_node(st->dt, "/interface/name[./]");
+    st->set = lyd_xpath_node(st->dt, "/interface/name[./]");
     assert_ptr_equal(st->set, NULL);
     assert_int_not_equal(ly_errno, 0);
 
-    st->set = lyd_get_node(st->dt, "/interface/name[./.]()");
+    st->set = lyd_xpath_node(st->dt, "/interface/name[./.]()");
     assert_ptr_equal(st->set, NULL);
     assert_int_not_equal(ly_errno, 0);
 }
@@ -211,31 +211,31 @@
 {
     struct state *st = (*state);
 
-    st->set = lyd_get_node(st->dt, "/ietf-interfaces:interfaces");
+    st->set = lyd_xpath_node(st->dt, "/ietf-interfaces:interfaces");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 1);
     ly_set_free(st->set);
     st->set = NULL;
 
-    st->set = lyd_get_node(st->dt, "/ietf-interfaces:interfaces/interface");
+    st->set = lyd_xpath_node(st->dt, "/ietf-interfaces:interfaces/interface");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 2);
     ly_set_free(st->set);
     st->set = NULL;
 
-    st->set = lyd_get_node(st->dt, "/ietf-interfaces:interfaces/interface[name='iface1']");
+    st->set = lyd_xpath_node(st->dt, "/ietf-interfaces:interfaces/interface[name='iface1']");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 1);
     ly_set_free(st->set);
     st->set = NULL;
 
-    st->set = lyd_get_node(st->dt, "/ietf-interfaces:interfaces/interface[name='iface1']/ietf-ip:ipv4/address");
+    st->set = lyd_xpath_node(st->dt, "/ietf-interfaces:interfaces/interface[name='iface1']/ietf-ip:ipv4/address");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 2);
     ly_set_free(st->set);
     st->set = NULL;
 
-    st->set = lyd_get_node(st->dt, "/ietf-interfaces:interfaces/interface[name='iface1']/ietf-ip:ipv4/address[ip='10.0.0.1']");
+    st->set = lyd_xpath_node(st->dt, "/ietf-interfaces:interfaces/interface[name='iface1']/ietf-ip:ipv4/address[ip='10.0.0.1']");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 1);
     ly_set_free(st->set);
@@ -247,37 +247,37 @@
 {
     struct state *st = (*state);
 
-    st->set = lyd_get_node(st->dt, "/ietf-interfaces:interfaces/interface[name='iface1']/ietf-ip:ipv4/*[ip]");
+    st->set = lyd_xpath_node(st->dt, "/ietf-interfaces:interfaces/interface[name='iface1']/ietf-ip:ipv4/*[ip]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 3);
     ly_set_free(st->set);
     st->set = NULL;
 
-    st->set = lyd_get_node(st->dt, "/ietf-interfaces:interfaces//*[ietf-ip:ip]");
+    st->set = lyd_xpath_node(st->dt, "/ietf-interfaces:interfaces//*[ietf-ip:ip]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 10);
     ly_set_free(st->set);
     st->set = NULL;
 
-    st->set = lyd_get_node(st->dt, "/ietf-interfaces:interfaces//*[ietf-ip:ip[.='10.0.0.1']]");
+    st->set = lyd_xpath_node(st->dt, "/ietf-interfaces:interfaces//*[ietf-ip:ip[.='10.0.0.1']]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 2);
     ly_set_free(st->set);
     st->set = NULL;
 
-    st->set = lyd_get_node(st->dt, "//ietf-ip:ip[.='10.0.0.1']");
+    st->set = lyd_xpath_node(st->dt, "//ietf-ip:ip[.='10.0.0.1']");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 2);
     ly_set_free(st->set);
     st->set = NULL;
 
-    st->set = lyd_get_node(st->dt, "//*[../description]");
+    st->set = lyd_xpath_node(st->dt, "//*[../description]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 14);
     ly_set_free(st->set);
     st->set = NULL;
 
-    st->set = lyd_get_node(st->dt, "//interface[name='iface1']/ipv4//*");
+    st->set = lyd_xpath_node(st->dt, "//interface[name='iface1']/ipv4//*");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 12);
     ly_set_free(st->set);
@@ -289,31 +289,31 @@
 {
     struct state *st = (*state);
 
-    st->set = lyd_get_node(st->dt, "//*[@*]");
+    st->set = lyd_xpath_node(st->dt, "//*[@*]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 6);
     ly_set_free(st->set);
     st->set = NULL;
 
-    st->set = lyd_get_node(st->dt, "//@*/..");
+    st->set = lyd_xpath_node(st->dt, "//@*/..");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 6);
     ly_set_free(st->set);
     st->set = NULL;
 
-    st->set = lyd_get_node(st->dt, "//*[@*[substring(local-name(.),1,2) = 'ip']]");
+    st->set = lyd_xpath_node(st->dt, "//*[@*[substring(local-name(.),1,2) = 'ip']]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 4);
     ly_set_free(st->set);
     st->set = NULL;
 
-    st->set = lyd_get_node(st->dt, "//*[@*[substring(local-name(.),1,2) = 'ip']]");
+    st->set = lyd_xpath_node(st->dt, "//*[@*[substring(local-name(.),1,2) = 'ip']]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 4);
     ly_set_free(st->set);
     st->set = NULL;
 
-    st->set = lyd_get_node(st->dt, "//*[@yang:ip_attr > '20']");
+    st->set = lyd_xpath_node(st->dt, "//*[@yang:ip_attr > '20']");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 2);
     ly_set_free(st->set);
@@ -325,60 +325,60 @@
 {
     struct state *st = (*state);
 
-    st->set = lyd_get_node(st->dt, "/ietf-interfaces:interfaces/interface/name[true() and not(false()) and not(boolean(. != 'iface1'))]");
+    st->set = lyd_xpath_node(st->dt, "/ietf-interfaces:interfaces/interface/name[true() and not(false()) and not(boolean(. != 'iface1'))]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 1);
     assert_string_equal(((struct lyd_node_leaf_list *)st->set->set.d[0])->value_str, "iface1");
     ly_set_free(st->set);
     st->set = NULL;
 
-    st->set = lyd_get_node(st->dt, "/ietf-interfaces:interfaces/interface/name[round(ceiling(1.8)+0.4)+floor(0.28)]");
+    st->set = lyd_xpath_node(st->dt, "/ietf-interfaces:interfaces/interface/name[round(ceiling(1.8)+0.4)+floor(0.28)]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 1);
     assert_string_equal(((struct lyd_node_leaf_list *)st->set->set.d[0])->value_str, "iface2");
     ly_set_free(st->set);
     st->set = NULL;
 
-    st->set = lyd_get_node(st->dt, "/ietf-interfaces:interfaces/interface/type[string-length(substring-after(\"hello12hi\", '12')) != 2 or starts-with(.,'iana') and contains(.,'back') and .=substring-before(concat(string(.),'aab', \"abb\"),'aa')]");
+    st->set = lyd_xpath_node(st->dt, "/ietf-interfaces:interfaces/interface/type[string-length(substring-after(\"hello12hi\", '12')) != 2 or starts-with(.,'iana') and contains(.,'back') and .=substring-before(concat(string(.),'aab', \"abb\"),'aa')]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 1);
     assert_string_equal(((struct lyd_node_leaf_list *)st->set->set.d[0])->value_str, "iana-if-type:softwareLoopback");
     ly_set_free(st->set);
     st->set = NULL;
 
-    st->set = lyd_get_node(st->dt, "//*[neighbor/link-layer-address = translate(normalize-space('\t\n01   .34    .56\t.78.9a\n\r.bc.de.f0  \t'), '. ', ':')]");
+    st->set = lyd_xpath_node(st->dt, "//*[neighbor/link-layer-address = translate(normalize-space('\t\n01   .34    .56\t.78.9a\n\r.bc.de.f0  \t'), '. ', ':')]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 2);
     ly_set_free(st->set);
     st->set = NULL;
 
-    st->set = lyd_get_node(st->dt, "//ip[position() = last()]");
+    st->set = lyd_xpath_node(st->dt, "//ip[position() = last()]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 1);
     assert_string_equal(((struct lyd_node_leaf_list *)st->set->set.d[0])->value_str, "2001:abcd:ef01:2345:6789:0:1:1");
     ly_set_free(st->set);
     st->set = NULL;
 
-    st->set = lyd_get_node(st->dt, "//ip[count(//*[.='52'])]");
+    st->set = lyd_xpath_node(st->dt, "//ip[count(//*[.='52'])]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 1);
     assert_string_equal(((struct lyd_node_leaf_list *)st->set->set.d[0])->value_str, "10.0.0.1");
     ly_set_free(st->set);
     st->set = NULL;
 
-    st->set = lyd_get_node(st->dt, "//*[local-name()='autoconf' and namespace-uri()='urn:ietf:params:xml:ns:yang:ietf-ip']");
+    st->set = lyd_xpath_node(st->dt, "//*[local-name()='autoconf' and namespace-uri()='urn:ietf:params:xml:ns:yang:ietf-ip']");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 2);
     ly_set_free(st->set);
     st->set = NULL;
 
-    st->set = lyd_get_node(st->dt, "//interface[name='iface2']//. | //ip | //interface[number((1 mod (20 - 15)) div 1)]//.");
+    st->set = lyd_xpath_node(st->dt, "//interface[name='iface2']//. | //ip | //interface[number((1 mod (20 - 15)) div 1)]//.");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 68);
     ly_set_free(st->set);
     st->set = NULL;
 
-    st->set = lyd_get_node(st->dt, "//ip[position() mod 2 = 1] | //ip[position() mod 2 = 0]");
+    st->set = lyd_xpath_node(st->dt, "//ip[position() mod 2 = 1] | //ip[position() mod 2 = 0]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 10);
     assert_string_equal(((struct lyd_node_leaf_list *)st->set->set.d[0])->value_str, "10.0.0.1");
@@ -389,7 +389,7 @@
     ly_set_free(st->set);
     st->set = NULL;
 
-    st->set = lyd_get_node(st->dt, "//*[1] | //*[last()] | //*[10] | //*[8]//.");
+    st->set = lyd_xpath_node(st->dt, "//*[1] | //*[last()] | //*[10] | //*[8]//.");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 15);
     ly_set_free(st->set);
diff --git a/tests/api/test_xpath_1.1.c b/tests/api/test_xpath_1.1.c
index 4b4d14e..d3e3b8a 100644
--- a/tests/api/test_xpath_1.1.c
+++ b/tests/api/test_xpath_1.1.c
@@ -105,7 +105,7 @@
     st->dt = lyd_parse_mem(st->ctx, data1, LYD_XML, LYD_OPT_CONFIG);
     assert_ptr_not_equal(st->dt, NULL);
 
-    st->set = lyd_get_node(st->dt, "/xpath-1.1:top/*[re-match(., 'a+b+c+')]");
+    st->set = lyd_xpath_node(st->dt, "/xpath-1.1:top/*[re-match(., 'a+b+c+')]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 2);
 }
@@ -118,7 +118,7 @@
     st->dt = lyd_parse_mem(st->ctx, data1, LYD_XML, LYD_OPT_CONFIG);
     assert_ptr_not_equal(st->dt, NULL);
 
-    st->set = lyd_get_node(st->dt, "deref(/xpath-1.1:top/instid) | deref(/xpath-1.1:top/lref)");
+    st->set = lyd_xpath_node(st->dt, "deref(/xpath-1.1:top/instid) | deref(/xpath-1.1:top/lref)");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 2);
 
@@ -134,7 +134,7 @@
     st->dt = lyd_parse_mem(st->ctx, data1, LYD_XML, LYD_OPT_CONFIG);
     assert_ptr_not_equal(st->dt, NULL);
 
-    st->set = lyd_get_node(st->dt, "/xpath-1.1:top/*[derived-from(., 'ident1')]");
+    st->set = lyd_xpath_node(st->dt, "/xpath-1.1:top/*[derived-from(., 'ident1')]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 0);
 }
@@ -147,7 +147,7 @@
     st->dt = lyd_parse_mem(st->ctx, data1, LYD_XML, LYD_OPT_CONFIG);
     assert_ptr_not_equal(st->dt, NULL);
 
-    st->set = lyd_get_node(st->dt, "/xpath-1.1:top/*[derived-from(., 'ident2')]");
+    st->set = lyd_xpath_node(st->dt, "/xpath-1.1:top/*[derived-from(., 'ident2')]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 0);
 }
@@ -160,7 +160,7 @@
     st->dt = lyd_parse_mem(st->ctx, data2, LYD_XML, LYD_OPT_CONFIG);
     assert_ptr_not_equal(st->dt, NULL);
 
-    st->set = lyd_get_node(st->dt, "/xpath-1.1:top/*[derived-from(., 'ident1')]");
+    st->set = lyd_xpath_node(st->dt, "/xpath-1.1:top/*[derived-from(., 'ident1')]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 1);
 }
@@ -173,7 +173,7 @@
     st->dt = lyd_parse_mem(st->ctx, data2, LYD_XML, LYD_OPT_CONFIG);
     assert_ptr_not_equal(st->dt, NULL);
 
-    st->set = lyd_get_node(st->dt, "/xpath-1.1:top/*[derived-from(., 'ident2')]");
+    st->set = lyd_xpath_node(st->dt, "/xpath-1.1:top/*[derived-from(., 'ident2')]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 0);
 }
@@ -186,7 +186,7 @@
     st->dt = lyd_parse_mem(st->ctx, data1, LYD_XML, LYD_OPT_CONFIG);
     assert_ptr_not_equal(st->dt, NULL);
 
-    st->set = lyd_get_node(st->dt, "/xpath-1.1:top/*[derived-from-or-self(., 'ident1')]");
+    st->set = lyd_xpath_node(st->dt, "/xpath-1.1:top/*[derived-from-or-self(., 'ident1')]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 1);
 }
@@ -199,7 +199,7 @@
     st->dt = lyd_parse_mem(st->ctx, data1, LYD_XML, LYD_OPT_CONFIG);
     assert_ptr_not_equal(st->dt, NULL);
 
-    st->set = lyd_get_node(st->dt, "/xpath-1.1:top/*[derived-from-or-self(., 'ident2')]");
+    st->set = lyd_xpath_node(st->dt, "/xpath-1.1:top/*[derived-from-or-self(., 'ident2')]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 0);
 }
@@ -212,7 +212,7 @@
     st->dt = lyd_parse_mem(st->ctx, data2, LYD_XML, LYD_OPT_CONFIG);
     assert_ptr_not_equal(st->dt, NULL);
 
-    st->set = lyd_get_node(st->dt, "/xpath-1.1:top/*[derived-from-or-self(., 'ident1')]");
+    st->set = lyd_xpath_node(st->dt, "/xpath-1.1:top/*[derived-from-or-self(., 'ident1')]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 1);
 }
@@ -225,7 +225,7 @@
     st->dt = lyd_parse_mem(st->ctx, data2, LYD_XML, LYD_OPT_CONFIG);
     assert_ptr_not_equal(st->dt, NULL);
 
-    st->set = lyd_get_node(st->dt, "/xpath-1.1:top/*[derived-from-or-self(., 'ident2')]");
+    st->set = lyd_xpath_node(st->dt, "/xpath-1.1:top/*[derived-from-or-self(., 'ident2')]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 1);
 }
@@ -238,7 +238,7 @@
     st->dt = lyd_parse_mem(st->ctx, data1, LYD_XML, LYD_OPT_CONFIG);
     assert_ptr_not_equal(st->dt, NULL);
 
-    st->set = lyd_get_node(st->dt, "/xpath-1.1:top/*[enum-value(.) = 2]");
+    st->set = lyd_xpath_node(st->dt, "/xpath-1.1:top/*[enum-value(.) = 2]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 1);
 }
@@ -251,7 +251,7 @@
     st->dt = lyd_parse_mem(st->ctx, data2, LYD_XML, LYD_OPT_CONFIG);
     assert_ptr_not_equal(st->dt, NULL);
 
-    st->set = lyd_get_node(st->dt, "/xpath-1.1:top/*[enum-value(.) = 10]");
+    st->set = lyd_xpath_node(st->dt, "/xpath-1.1:top/*[enum-value(.) = 10]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 1);
 }
@@ -264,7 +264,7 @@
     st->dt = lyd_parse_mem(st->ctx, data1, LYD_XML, LYD_OPT_CONFIG);
     assert_ptr_not_equal(st->dt, NULL);
 
-    st->set = lyd_get_node(st->dt, "/xpath-1.1:top/*[bit-is-set(., 'flag3')]");
+    st->set = lyd_xpath_node(st->dt, "/xpath-1.1:top/*[bit-is-set(., 'flag3')]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 1);
 }
@@ -277,7 +277,7 @@
     st->dt = lyd_parse_mem(st->ctx, data1, LYD_XML, LYD_OPT_CONFIG);
     assert_ptr_not_equal(st->dt, NULL);
 
-    st->set = lyd_get_node(st->dt, "/xpath-1.1:top/*[bit-is-set(., 'flag2')]");
+    st->set = lyd_xpath_node(st->dt, "/xpath-1.1:top/*[bit-is-set(., 'flag2')]");
     assert_ptr_not_equal(st->set, NULL);
     assert_int_equal(st->set->number, 0);
 }
diff --git a/tools/lint/commands.c b/tools/lint/commands.c
index 44f2dff..20fb4e9 100644
--- a/tools/lint/commands.c
+++ b/tools/lint/commands.c
@@ -591,7 +591,7 @@
         goto cleanup;
     }
 
-    if (!(set = lyd_get_node(data, expr))) {
+    if (!(set = lyd_xpath_node(data, expr))) {
         goto cleanup;
     }