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

Re: xml vs json

Subject: Re: xml vs json
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 16 Apr 2022 22:19:05 -0000
Re:  xml vs json
All these points are valid, but I would add a couple more:

(a) XSLT 3.0 lacks a convenient way of constructing arrays.

(b) Pattern syntax for matching maps and arrays is rather limited compared
with the syntax for matching nodes. This is partly because JSON lacks any
concept equivalent to element names in XML: different types of object in JSON
are identified by their internal structure, not by name.

(c) The data model for JSON lacks a parent/ancestor axis, which means that
template rules can't access information from outer containers; instead all the
information required has to be passed down using parameters (typically tunnel
parameters). A further complication is that parameter values can't be accessed
in match patterns, so template rules cannot match content in a
context-sensitive way.

As for your specific question, I published a couple of use cases for JSON
transformations at XML Prague 2016
(https://www.saxonica.com/papers/xmlprague-2016mhk.pdf) and you may find these
helpful. I can probably dig out the actual files I used if you are
interested.

Michael Kay
Saxonica

> On 16 Apr 2022, at 21:54, Vladimir Nesterovsky vladimir@xxxxxxxxxxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Let's assume you're agnostic regarding input and output formats, so you're
ready to work either with xml or with logically equivalent json input and
output data.
>
> Then we have a question: how xslt processing will compare for two logically
equivalent pipelines: where one deals with xml, and other with json?
>
> We have several hypotheses that hint on advantage of json, like:
> json is lighter than xml to serialize and deserialize;
> json stored as map(*), array(*) and other item() are lighter than node() at
runtime, in particular subtree copy has zero cost in json;
> templates with match patterns to some extent can be efficiently implemented
for maps using lookups of functions;
> To prove anything we need to commit an experiment (we're going to use Saxon
as engine).
>
> So, our question to the community: is there an isolated small representative
xslt around xml (along with xml files) for us to use as a model to build
equivalent xslt around json?
>
> Thanks
> --
> Vladimir Nesterovsky
>
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/293509> (by
email <>)

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.