3 ms·
To be fair, xslt is a lot more verbose than `map(.*2)`
by nurettin 3y ago
To be fair, xslt is a lot more verbose than `map(.*2)`
- lkuty 3y agoA bit more verbose but you have the full power of XQuery with you. XSLT however is more verbose than that like you mentioned. for $price in json-to-xml(unparsed-text($file))/map/map/number[@key="price"] return $price+2 For the following JSON document: { "fruit1": { "name": "apple", "color": "green", "price": 1.2 }, "fruit2": { "name": "pear", "color": "green", "price": 1.6 } } The call to json-to-xml() produces this XML document: <?xml version="1.0" encoding="UTF-8"?> <map xmlns="http://www.w3.org/2005/xpath-functions"> <map key="fruit1"> <string key="name">apple</string> <string key="color">green</string> <number key="price">1.2</number> </map> <map key="fruit2"> <string key="name">pear</string> <string key="color">green</string> <number key="price">1.6</number> </map> </map>