xsl-list
[Top] [All Lists]

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

2020-08-19 08:51:55
Am 19.08.2020 um 15:36 schrieb Terry Ofner tdofner(_at_)gmail(_dot_)com:

By replacing the $p in the map:merge(($p … 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 “see” 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.

--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>