Take a look here https://en.wikibooks.org/wiki/XQuery/Displaying_Lists

Loren Cahlander

On Feb 15, 2020, at 10:40 PM, Graydon <graydonish@gmail.com> wrote:

On Sat, Feb 15, 2020 at 07:10:46PM -0800, thufir scripsit:
I'll read your response more carefully, but key takeaway is to maybe use
something else?  I'm futzing with powershell, seems reasonable for the task
(if a bit odd).

XQuery's entirely suitable; you might not find the csv functions
specifically suitable, it what I was trying to get at.  Those suppose
that your XML is already structured in a specific regular way.

CSV (and JSON) suffer from this expectation that they're easy formats.
In practice, for any kind of non-trivial data, this isn't the case.  A
certain amount of design is required for any conversion; in the CSV
case, that's usually "do all my rows/records have the same columns in
the same order?" but it can be other things.  ("Everything I might want
to use as a separator exists in the data, as do a lot of double quotes",
for example.)

-- Graydon