tag:blogger.com,1999:blog-8779027097922009803.post7770752765575832990..comments2023-08-16T04:59:05.497-07:00Comments on Share your knowledge: Apache Cocoon: From XML to JSON as datasource for client or server side JavascriptAnonymoushttp://www.blogger.com/profile/08988603608690509267noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-8779027097922009803.post-50236085194481718922011-11-21T05:27:43.765-08:002011-11-21T05:27:43.765-08:00Hi Ivan,
a actually tried to do exactly as you pr...Hi Ivan,<br /><br />a actually tried to do exactly as you proposed using Sedna. But at the time i could only serialize to XML. Maybe this has changed meanwhile. But as I stated another reason is formatting values. XSLT provides functions for formatting numbers and dates whereas XQuery does not. Also I had a use case where the value was CDATA so I still had to do some postprocessing with XSLT to be able to use XSLT's feature 'Disable-ouput-escaping'.Anonymoushttps://www.blogger.com/profile/08988603608690509267noreply@blogger.comtag:blogger.com,1999:blog-8779027097922009803.post-69478294500319530062011-11-21T05:17:37.810-08:002011-11-21T05:17:37.810-08:00Very nicely described.
Just one suggestion from ...Very nicely described. <br /><br />Just one suggestion from my side. Using your approach we still need to generate that JSON-XML dialect first. Although you didn't mention it, it can be obviously created by XQuery from initial xml source. Then why don't we generate JSON from XQuery and avoid xslt processing step completely? It seems to be possible according to this tutorial:<br />http://en.wikibooks.org/wiki/XQuery/Simile_Exhibit#XQuery_to_Output_JSON_File<br /><br />Well, yes, it uses exist:serialize option there but Sedna XML DB provides a similar one:<br />http://www.sedna.org/one-page/ProgGuide.html#x1-300002.2.1<br /><br />Although I didn't try it on my own but, it looks even more straightforward.Ivan Lagunovhttps://www.blogger.com/profile/06646687524888275044noreply@blogger.com