xsl-list
[Top] [All Lists]

Re: [xsl] XSLT functions for JSON

2008-05-18 11:47:25
On Sun, 2008-05-18 at 12:35 -0600, M. David Peterson wrote:
On Sun, 18 May 2008 07:52:35 -0600, Jesper Tverskov 
<jesper(_at_)tverskov(_dot_)dk>  
wrote:

property names in JSON could begin with characters not allowed as
first character in XML like "$" (used by Goggle) and "@", and "#" used
by article.

This list also includes numbers, so while a sequence of numbers e.g. (1,  
2, 3) is valid as far as XSLT is concerned (and therefore a JSON array  
could easily be converted to a valid sequence), it would be invalid to do  
something like <array><1/><2/><3/></array>, though as per Robert's  
suggestion, you could do something like  
<array><i>1</i><i>2</i><i>3</i></array>.  

If I remeber correctly, org.json and json-lib (my preferred java
library) would write this as:

<a>
  <e>1</e>
  <e>2</e>
  <e>3</e>
</a>

Again, the best that could be done is to follow the rules laid out by
org.json



Of course, if the entire point  
is to enabled to traverse a JSON document in the same way you would  
traverse an XML document (a.k.a XPath), then, once again, it seems to me  
the real problem to solve here is how do we go about traversing a JSON  
document with XPath instead of how do we convert JSON to XML and back  
again.



--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>