Open priyankac1411 opened 4 years ago
This probably happens because the stylesheet tm-json.xsl
was generated when the environment variable PYANG_XSLT_DIR
was unset.
no, I have generated the tm-son.xsl after PYANG_XSLT_DIR was set.Can you plz help me in solving this
Please check the <include href="..."/>
element in tm-json.xsl
. The value of its href
attribute is set to the value of PYANG_XSLT_DIR
, if it exists:
xsltdir = os.environ.get("PYANG_XSLT_DIR",
"/usr/local/share/yang/xslt")
ET.SubElement(ss, "include", href=xsltdir + "/jsonxsl-templates.xsl")
So before generating the stylesheet, you can start Python and check the value of that environment variable:
$ python
Python 3.8.6 (default, Sep 30 2020, 04:00:38)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.environ.get("PYANG_XSLT_DIR")
'/home/lhotka/Projects/pyang/xslt'
>>>
Thanx it worked . can we convert yang to xml. If yes ,then whats the procedure?
Do you mean the conversion from JSON to XML?
@priyankac1411 for yang to xml conversion use below command: pyang -f xsd --xsd-groups --xsd-no-any-augments filename.yang
This will give you xml output.
@priyankac1411 for yang to xml conversion use below command: pyang -f xsd --xsd-groups --xsd-no-any-augments filename.yang
This will give you xml output.
The xsd
plugin was supposed to produce W3C XML Schema from YANG. I believe though that this plugin is long unmaintained and doesn't really work.
JSON<->XML conversions of instance data are described in this tutorial.
when I am using this command xsltproc -o turing-machine-config.json tm-json.xsl turing-machine-config.xml
I am receiving the following errorwarning: failed to load external entity "/usr/local/share/yang/xslt/jsonxsl-templates.xsl" compilation error: file tm.xsl line 2 element include xsl:include : unable to load /usr/local/share/yang/xslt/jsonxsl-templates.xsl
I have set the environment variables PWD=/home/priya/pyang PYANG_XSLT_DIR=/home/priya/pyang/pyang/xslt MANPATH=/home/priya/pyang/man: W=/home/priya/pyang PYANG_RNG_LIBDIR=/home/priya/pyang/pyang/schema YANG_MODPATH=/home/priya/pyang/modules: PYTHONPATH=/home/priya/pyang: