Re: [xsl] XSLT functions for JSON

Subject: Re: [xsl] XSLT functions for JSON
From: "James Fuller" <james.fuller.2007@xxxxxxxxx>
Date: Mon, 19 May 2008 09:34:48 +0200
On Mon, May 19, 2008 at 7:54 AM, Jesper Tverskov <jesper@xxxxxxxxxxx> wrote:
> This thread is about the need for functions in XSLT making it easy to
> transform relevant XML to JSON and json2xml.

your original post listed drawbacks to JSON which you then go to solve
by proposing functions marshaling a serialization format into XML ...

> We should not discuss JSON versus XML.  JSON is mostly relevant for
> AJAX based web application in order to optimize them for speed and for
> an easier interface.

agreed to the speed argument ... I would place a caveat to 'easier
interface' and say 'if working in javascript, provides an easier
interface'

> At the beginning of the thread I proposed 3 functions, a general
> json2xml and a pair of xml2json and json2xml making back and forth
> transformation possible.

yes, but I would argue to just not use JSON and use XML ... I am
assuming u are talking about the scenario where u are forced to use
JSON .... which in that case you can either spend the time to provide
a generic solution and all that entails (roundtripping will be
interesting) or just have separate widget outside of XSLT that
converts JSON into XML.

> The back and forth is far the most difficult and maybe not that useful
> except that it so to speak is proof of the pudding.

> Still it would be nice to have jason2xml (FXSL is one example) and
> also xml2jason for data-oriented markup when it makes sense. And maybe
> we should just accept that back and forth transformation is only
> possible and relevant for the most data-oriented and json friendly
> XML.

EXSLT is another possibility for XSLT 1 (now that firefox 3 has it built in it)

gl, Jim Fuller

Current Thread