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: Thu, 13 Aug 2020 21:15:19 -0000
On 13.08.2020 22:59, Terry Ofner tdofner@xxxxxxxxx wrote:
Wow. That is certainly efficient. I can see that I have some catching up
to do. I am not familiar with as=map() and the call of it.

I am looking now at the version using iterate. So, the sequence inside
$groups looks something like this:

bletterb : <span class=bletterb>S</span> : btermb : <span
class=btermb>sentence</span>


Similar in construction to JSON?

Maps are lightweight data structures that can be used to represent JSON objects but are more flexible as they, as in my example, are not restricted to the JSON values number, string, boolean, array or object but can contain any XPath 3.1 item, in this case an element node.



I am also unfamiliar with the use of the exclamation point in <xsl:iterate select="p[@class = 'nl'] ! $groupsb>

It is the map operator introduced in XPath 3.0 to simplify and generalize `for .. return ..` expressions so instead of <xsl:iterate select="for $p in p[@class = 'nl'] return $groups"> you can use the above example.


Similarly, the question mark in the population of the attributes is new to me" letter="{?letter}b.

The question mark serves as a lookup operator for maps (and arrays), in this case it reads out the property named 'letter' of the processed map. It is not related to attributes, just used here in the attribute value template to populate the attribute value.

Current Thread