xsl-list
[Top] [All Lists]

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

2019-03-13 15:28:58
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(_dot_)mukul(_at_)gmail(_dot_)com
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

On Mon, Mar 11, 2019 at 11:33 AM Mukul Gandhi 
<gandhi(_dot_)mukul(_at_)gmail(_dot_)com> 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)



-- 
Wendell Piez | wendellpiez.com | wendell -at- nist -dot- gov
pellucidliterature.org | github.com/wendellpiez |
gitlab.coko.foundation/wendell  - pausepress.org
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

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