Re: [xsl] Convert JSON to XML?

Subject: Re: [xsl] Convert JSON to XML?
From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 1 May 2025 23:50:51 -0000
On Thu, 2025-05-01 at 22:35 +0000, dvint@xxxxxxxxx wrote:
> I know (and have been using) the xlst json-to-xml() function for this
> purpose, but it is a pretty basic result. I happened to try the JSON
> to
> XML funtion in oXygen and got what I'd say is a much better result
> where
> I had some unique elemeent names instead of everything being a map or
> a
> string element.

A difficulty with that is that keys in JSON are arbitrary strings and
not necessarily valid XML names.

If that's no an issue, yes, there's BaseX implementations, and a simple
recursive descent approach would probably work fine in XSLT or XQuery
(you don't mention which language to use).


--
Liam Quin,B https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations: B http://www.fromoldbooks.org

Current Thread