|
Subject: Re: [xsl] json to json transformation From: "Mukul Gandhi gandhi.mukul@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 15 Mar 2019 11:16:07 -0000 |
On Fri, Mar 15, 2019 at 4:31 PM Martin Honnen martin.honnen@xxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> In general I agree that conversion to XML allows easier processing of
> and transformation of JSON but your simply example could also be done at
> the XPath 3.1 level with map functions:
>
> <xsl:output method="json" indent="yes"/>
>
> <xsl:param name="json-string" as="xs:string">{
> "id" : 105,
> "medals" : [1, 2, 3],
> "fName" : "Mukul",
> "lName" : "Gandhi",
> "address" : {
> "street1" : "xyz",
> "street2" : "maddison avenue",
> "country" : "C1"
> }
> }</xsl:param>
>
> <xsl:variable name="map1" select="parse-json($json-string)"/>
>
> <xsl:template match="/">
> <xsl:sequence select="map:remove(map:put($map1, 'name',
> $map1?fName || ' ' || $map1?lName), ('fName', 'lName'))"/>
> </xsl:template>
>
Thanks Martin, for insights. I need to catch up with more XSLT 3.0 reading
on this. I also wish to read the paper which Mike has mentioned.
BTW: What did you get the medals for?
No medals. It was just a random thought.
--
Regards,
Mukul Gandhi
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] json to json transformati, Martin Honnen martin | Thread | Re: [xsl] json to json transformati, Mukul Gandhi gandhi. |
| Re: [xsl] json to json transformati, Martin Honnen martin | Date | Re: [xsl] json to json transformati, Mukul Gandhi gandhi. |
| Month |