[xsl] XSLT code for XML to JSON conversion?

Subject: [xsl] XSLT code for XML to JSON conversion?
From: "Richard Fozzard richard.fozzard@xxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 12 Dec 2019 21:31:53 -0000
Hi Folks,

We're looking to do conversion of relatively complex XML (i.e. namespaces, attributes, repeating elements, xlinks) into JSON from the Unix command line to build a web page. We'veB used the XML to JSON feature in the Oxygen Developer tool, and it works well, but that's a GUI, not a command line tool.

Does anyone else here convert XML to JSON? Any recommendations on a stylesheet we could use?

Many thanks for any help,



There seems to be a wide variety of open source stylesheets out there. We've looked at:

B - Doeke Zanstra's xml2json utility https://github.com/doekman/xml2json-xslt
B - Bram Stein's xml-to-json https://github.com/bramstein/xsltjson
B - Darrell Miller's http://www.bizcoder.com/convert-xml-to-json-using-xslt
B - Jens Duttke's xml2json https://xml2json.duttke.de/
B - Bojan BjeliD's xml2json https://www.bjelic.net/2012/08/01/coding/convert-xml-to-json-using-xslt/

...and other unnamed scripts found in forums.

Most seem to use XSL 1, but Bram Stein's uses XSL 2 and Saxon, implying more sophistication. We do have a SaxonPE site license. We'd even be willing to pay if there's a supported COTS stylesheet.

Richard Fozzard, Computer Scientist
  Geospatial Metadata at NGDC: https://data.noaa.gov/

Cooperative Institute for Research in Environmental Sciences (CIRES)
Univ. Colorado & NOAA National Centers for Environmental Information
151 Patton Ave, Room 468, Asheville, NC 28801
Cell: 303-579-5615, Email: richard.fozzard@xxxxxxxx

Current Thread