xsl-list
[Top] [All Lists]

Re: [xsl] Recovering the 'document order' of parsed json

2013-10-29 08:32:09
On Tue, October 29, 2013 12:23 pm, David Cramer wrote:
...
Sure it's true that json maps are not ordered, but for documentation
purposes it is often helpful to present items in a logical order.
Consider the code sample in:

https://github.com/rackerlabs/otter/blob/master/docbook/src/docbkx/samples/reqCreatePolicy-changePercentAlarm.json

When you make the api call, it doesn't matter what order you list name,
changePercent, cooldown, type, and args, but for the purposes of
documenting the request, starting with "name" will look a lot more
natural and logical than starting with "args".

So would you be better off with a XML representation of the JSON rather
than the JSON as XSLT/XPath datatypes?

There is, e.g., David Lee's "JSON XML Schema (JXML)" at
http://xml.calldei.com/JsonXML, but given his stated conceptual
difficulties with XSLT, he's unlikely to have produced a XSLT library for
parsing JSON into JXML.

I've also found http://www.gerixsoft.com/blog/xslt/json2xml and
https://dnovatchev.wordpress.com/2007/07/05/transforming-json/ but YMMV
since you may just be wanting elements for the different JSON types as in
JXML rather than turning JSON names into XML element names as in the other
approaches that I've seen.

Regards,


Tony Graham                                   tgraham(_at_)mentea(_dot_)net
Consultant                                 http://www.mentea.net
Mentea       13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
 --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
    XML, XSL-FO and XSLT consulting, training and programming
       Chair, Print and Page Layout Community Group @ W3C



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--