[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

Subject: Re: is XPath 3.1 xml-to-json() function useful
From: "Mukul Gandhi gandhi.mukul@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 11 Mar 2019 06:04:19 -0000
Re:  is XPath 3.1 xml-to-json() function useful
I'm continuing on this topic.

On Fri, Mar 8, 2019 at 4:39 PM Michael Kay mike@xxxxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> we decided on a different approach: provide a function to convert a very
> specific XML vocabulary to JSON, and then (because we already have powerful
> XML-to-XML transformation capabilities), let the user say how their
> particular XML should be transformed to that vocabulary.
>

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
        ]
    }
}

How can I do this with XSLT 3.0 and XPath 3.1's fn:xml-to-json() function ?




-- 
Regards,
Mukul Gandhi

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.