Re: [xsl] is XPath 3.1 xml-to-json() function useful

Subject: Re: [xsl] is XPath 3.1 xml-to-json() function useful
From: "Christophe Marchand cmarchand@xxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 14 Mar 2019 16:08:20 -0000
+1 for the exceptional XSLT average developer !

Le 13/03/2019 C 21:28, Wendell Piez wapiez@xxxxxxxxxxxxxxx a C)critB :
Hi Mukul,

I agree provisionally, however I would also recast your claim a
little: I think good tools (like oXygen in this case) do make it
possible to be much more ambitious with XSLT, if only because they
make it possible to visualize, represent and manage more complex
processes, such (in this case for example) as 2-stage or multi-stage
pipelines producing specialized serialization formats including JSON.

But that sounds hard to disagree with doesn't it? Aren't we saying
that good tools make difficult things easier, if you know how to use
them? I do wonder who you have in mind when you talk about the
"average developer" as mostly, she or he would not be writing XSLT,
would they? The average XSLT developer is already exceptional. :-)

Cheers, Wendell

On Tue, Mar 12, 2019 at 1:16 AM Mukul Gandhi gandhi.mukul@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
On Mon, Mar 11, 2019 at 11:33 AM Mukul Gandhi <gandhi.mukul@xxxxxxxxx> wrote:
Lets say, we've a following input XML document,

<?xml version="1.0" encoding="UTF-8"?>
<root>
    <val>1</val>
    <val>2</val>
    <val>3</val>
    <val>4</val>
</root>

I would want to transform above XML document to following JSON,

{
     "root": {
         "val": [
             1,
             2,
             3,
             4
         ]
     }
}

For the interest of readers, I actually got above XML to JSON conversion done using <oXygen/> XML editor, and then we (actually Martin) solved this with XSLT 3.0. As a best practice to convert XML into JSON using XSLT 3.0, I think its a good idea to get a feel of the suitable JSON document for a XML document, using tool like <oXygen/> XML, and then automate this with a XSLT 3.0 & XPath 3.1 solution.


Without support of a tool like <oXygen/> XML, I think it'll be harder for an average developer using XSLT 3.0 to produce XML to JSON conversions.




-- Regards, Mukul Gandhi XSL-List info and archive EasyUnsubscribe (by email)

Current Thread