From 3333b21f031c2b4342748c1f3078283ae04a7b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rklund?= Date: Thu, 2 Nov 2023 13:39:21 +0100 Subject: [PATCH] wip --- pyang/plugins/jsonxsl.py | 2 +- pyang/plugins/sid.py | 6 +++--- test/test_xpath/expect/a.yang.out | 2 +- test/test_xpath/expect/as.yang.out | 2 +- test/test_xpath/expect/bugs-from-ietf-modules.yang.out | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pyang/plugins/jsonxsl.py b/pyang/plugins/jsonxsl.py index 82ee9fe10..e5a7fb37f 100644 --- a/pyang/plugins/jsonxsl.py +++ b/pyang/plugins/jsonxsl.py @@ -155,7 +155,7 @@ def process_children(self, node, path, level, parent=None): tmpl = self.xsl_template(p) ct = self.xsl_calltemplate(ch.keyword, tmpl) self.xsl_withparam("level", "%d" % level, ct) - if (data_parent.i_module is None or + if (data_parent.parent is None or ch.i_module.i_modulename != data_parent.i_module.i_modulename): self.xsl_withparam("nsid", ch.i_module.i_modulename + ":", ct) if ch.keyword in ["leaf", "leaf-list"]: diff --git a/pyang/plugins/sid.py b/pyang/plugins/sid.py index dc9134ff3..5b828d158 100644 --- a/pyang/plugins/sid.py +++ b/pyang/plugins/sid.py @@ -658,18 +658,18 @@ def collect_in_substmts(self, substmts): def get_path(self, statement, prefix=""): path = "" - while statement.i_module is not None: + while statement.parent is not None: if (statement.keyword not in self.grouping_keywords and not self.has_yang_data_extension(statement)): # Locate the data node parent parent = statement.parent - while parent.i_module is not None: + while parent.parent is not None: if parent.keyword in self.module_keywords: break parent = parent.parent if (prefix != "" or - (parent.i_module is not None and parent.i_module == statement.i_module)): + (parent.parent is not None and parent.i_module == statement.i_module)): path = "/" + statement.arg + path else: path = "/" + statement.i_module.arg + ":" + statement.arg + path diff --git a/test/test_xpath/expect/a.yang.out b/test/test_xpath/expect/a.yang.out index fab1978f8..799f6fcf8 100644 --- a/test/test_xpath/expect/a.yang.out +++ b/test/test_xpath/expect/a.yang.out @@ -4,4 +4,4 @@ a.yang:32: warning: XPATH_NODE_NOT_FOUND2 a.yang:58: error: XPATH_SYNTAX_ERROR a.yang:63 (at a.yang:59): warning: XPATH_NODE_NOT_FOUND1 a.yang:60: error: XPATH_SYNTAX_ERROR -as.yang:9 (at b.yang:7): warning: XPATH_NODE_NOT_FOUND2 +as.yang:9 (at b.yang:7): warning: XPATH_NODE_NOT_FOUND1 diff --git a/test/test_xpath/expect/as.yang.out b/test/test_xpath/expect/as.yang.out index 471493128..bbb57f527 100644 --- a/test/test_xpath/expect/as.yang.out +++ b/test/test_xpath/expect/as.yang.out @@ -1 +1 @@ -as.yang:9 (at b.yang:7): warning: XPATH_NODE_NOT_FOUND2 +as.yang:9 (at b.yang:7): warning: XPATH_NODE_NOT_FOUND1 diff --git a/test/test_xpath/expect/bugs-from-ietf-modules.yang.out b/test/test_xpath/expect/bugs-from-ietf-modules.yang.out index 317bf3b7a..fe295cdf6 100644 --- a/test/test_xpath/expect/bugs-from-ietf-modules.yang.out +++ b/test/test_xpath/expect/bugs-from-ietf-modules.yang.out @@ -1,3 +1,3 @@ -bugs-from-ietf-modules.yang:12: warning: XPATH_NODE_NOT_FOUND2 +bugs-from-ietf-modules.yang:12: warning: XPATH_NODE_NOT_FOUND1 bugs-from-ietf-modules.yang:27: warning: XPATH_NODE_NOT_FOUND1 bugs-from-ietf-modules.yang:27: warning: XPATH_NODE_NOT_FOUND1