Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mbj4668 committed Nov 2, 2023
1 parent 7abd337 commit 3333b21
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pyang/plugins/jsonxsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]:
Expand Down
6 changes: 3 additions & 3 deletions pyang/plugins/sid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/test_xpath/expect/a.yang.out
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion test/test_xpath/expect/as.yang.out
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion test/test_xpath/expect/bugs-from-ietf-modules.yang.out
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3333b21

Please sign in to comment.