xsl-list
[Top] [All Lists]

Aw: [xsl] problem with json-to-xml()

2020-06-22 00:21:27
Add `xpath-default-namespace="http://www.w3.org/2005/xpath-functions";`

--
Diese Nachricht wurde von meinem Android Mobiltelefon mit GMX Mail gesendet.
Am 22.06.20, 07:12 schrieb "Wolfhart Totschnig wolfhart(_dot_)totschnig(_at_)mail(_dot_)udp(_dot_)cl" <xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com>:
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):

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

<Prev in Thread] Current Thread [Next in Thread>
  • Aw: [xsl] problem with json-to-xml(), Martin Honnen martin(_dot_)honnen(_at_)gmx(_dot_)de <=