I am trying to convert JSON data to XML in XSLT 3.0 using json-to-xml function,but the produced xml is not as expected
for example Input JSON:
{
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
"Acronym": "SGML",
"Abbrev": "ISO 8879:1986",
"GlossDef": {
"para": "A meta-markup language, used to create markup languages such as DocBook.",
"GlossSeeAlso": ["GML", "XML"]
},
"GlossSee": "markup"
}
}
}
}
}
Generated XML from XSLT3.0:
<?xml version="1.0" encoding="UTF-8"?>
<map xmlns="http://www.w3.org/2005/xpath-functions">
<map key="glossary">
<string key="title">example glossary</string>
<map key="GlossDiv">
<string key="title">S</string>
<map key="GlossList">
<map key="GlossEntry">
<string key="ID">SGML</string>
<string key="SortAs">SGML</string>
<string key="GlossTerm">Standard Generalized Markup Language</string>
<string key="Acronym">SGML</string>
<string key="Abbrev">ISO 8879:1986</string>
<map key="GlossDef">
<string key="para">A meta-markup language, used to create markup languages such as DocBook.</string>
<array key="GlossSeeAlso">
<string>GML</string>
<string>XML</string>
</array>
</map>
<string key="GlossSee">markup</string>
</map>
</map>
</map>
Expected XML format:
<glossary>
<title>example glossary</title>
<GlossDiv>
<title>S</title>
<GlossList>
<GlossEntry>
<ID>SGML</ID>
<SortAs>SGML</SortAs>
<GlossTerm>Standard Generalized Markup Language</GlossTerm>
<Acronym>SGML</Acronym>
<Abbrev>ISO 8879:1986</Abbrev>
<GlossDef>
<para>A meta-markup language, used to create markuplanguages such as DocBook.</para>
<GlossSeeAlso OtherTerm="GML">
<GlossSeeAlso OtherTerm="XML">
</GlossDef>
<GlossSee OtherTerm="markup">
</GlossEntry>
</GlossList>
</GlossDiv>
</glossary>
My Major problem here is to ignore these key attributes and print attribute(key) value as element name and actual text as the element text.
can you guys please help me to achieve this.