Re: [xsl] Using xsl:iterate inside <xsl:for-each-group> xslt 3.0

Subject: Re: [xsl] Using xsl:iterate inside <xsl:for-each-group> xslt 3.0
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 19 Aug 2020 13:51:51 -0000
Am 19.08.2020 um 15:36 schrieb Terry Ofner tdofner@xxxxxxxxx:

By replacing the $p in the map:merge(($p b& with ., the two maps are
merged. Is that how this works?

Yes, you could use map:put also I think to "add" the element to the map.
The previous attempts also merged but not at the right level, as we have
a sequence of maps in $groups the aim was to add a property named "p"
with a "p" element to each map in the sequence which I failed to code
that correctly on previous attempts.


Maps are black boxes to me. Is there a way to bseeb inside? With a
variable, you can do a copy-of to see if everything is okay in there. When I
try to copy a map I get an error.

Unfortunately the use of `xsl:message` has not been "upgraded" in XSLT
3.0 to cover the full XPath 3.1 data model with functions, maps, arrays,
it pretty much expects a a tree of nodes or sequences of nodes.

And you can't output a map inside an element.

What you can do to output a string representation of a map is to use
(XPath 3.1 you can use in any "select" expression or other attributes of
XSLT 3 elements)

serialize($map, map { 'method' : 'adaptive' })

Unfortunately for the 'adaptive' method Saxon does not support indenting
so it is a bit difficult to read anything output that way.

Maps that restrict themselves to the JSON data model can also be
serialized as JSON by using

serialize($map, map { 'method' : 'json', 'indent' : true() })

instead.

I am not sure how good the oXygen debugger is now showing maps or arrays.

Current Thread