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

problem with json-to-xml()

Subject: problem with json-to-xml()
From: "Wolfhart Totschnig wolfhart.totschnig@xxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 22 Jun 2020 05:12:34 -0000
 problem with json-to-xml()
Hello,

I am using the json-to-xml() function for the first time and cannot get it to work. I was hoping that one of you could help me.

I have JSON data stored in a text file called "json". I can transform this data into xml and insert it into my output document with

json-to-xml(unparsed-text('json'))

That works as expected. The xml data that is produced from the JSON data and inserted into my output document looks like this (abbreviated):

B <map xmlns="http://www.w3.org/2005/xpath-functions">
B B B B B B B B <string key="@context">http://lobid.org/resources/context.jsonld</string>
B B B B B B B B <string key="id">http://lobid.org/resources/search?q=isbn:3-492-21746-X&amp;format=json</string>
B </map>


Now, what I really would like to add to my output is the value of /map/string[@key='id'], that is, "http://lobid.org/resources/search?q=isbn:3-492-21746-X&amp;format=json". I thought that it would be as simple as this:

<xsl:value-of select="json-to-xml(unparsed-text('json'))/map/string[@key='id']"/>

But this doesn't work. It does not produce any output. What am I misunderstanding?

Thanks in advance for your help!

Wolfhart

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.