[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XSLT code for XML to JSON conversion?

Subject: Re: XSLT code for XML to JSON conversion?
From: "Steven D. Majewski steve.majewski@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 12 Dec 2019 22:37:30 -0000
Re:  XSLT code for XML to JSON conversion?
There are also non XSLT converters that use SAX: read XML and serialize out as
JSON.

There are several node-js packages.
Python xmljson. https://pypi.org/project/xmljson/
<https://pypi.org/project/xmljson/> supports several different JSON encoding
conventions.

And Ibm sure many others.
( Ibve used the Python package, but not for any large projects.  )

b Steve.


> On Dec 12, 2019, at 5:09 PM, Liam R. E. Quin liam@xxxxxxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Thu, 2019-12-12 at 21:32 +0000, Richard Fozzard
> richard.fozzard@xxxxxxxx wrote:
>> 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've  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.
>
> It's probably using XSLT under the hood, with a stylesheet that's
> usable e.g. with Saxon. You do pay the penalty of Java runtime startup,
> though.
>
> Note also that XSLT 3 includes a standard function to produce JSON; see
> https://www.w3.org/TR/xpath-functions-31/#json-to-xml-mapping
>
> So you could just use xml-to-json() in XSLT. You may need Saxon EE for
> that, i'm not sure offhand.
>
> Of course, you could also just send XML to the Web client; what you are
> doing by using a complex transformation into JSON is moving the
> complexity from one developer to another. You could also generate HTML
> on the server, whic might make it easier to meet 508/WCAG requirements
> :)
>
> Liam
>
> --
> Liam Quin, https://www.delightfulcomputing.com/
> Available for XML/Document/Information Architecture/XSLT/
> XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
> Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.