我试图JSON数据转换为XML的XSLT 3.0使用JSON到XML的功能,但并不如预期所产生的XML
例如输入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"
}
}
}
}
}
生成的XML从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>
预期的XML格式:
<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>
我在这里的主要问题是忽略这些关键属性和打印属性(键)值作为元素名称和实际文本作为元素的文本。
你们可以帮我实现这一目标。