xsl-list
[Top] [All Lists]

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

2020-08-13 16:15:25
On 13.08.2020 22:59, Terry Ofner tdofner(_at_)gmail(_dot_)com 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:

‘letter’ : <span class=’letter’>S</span> : ’term’ : <span
class=“term”>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'] ! $groups”>

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}”.

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.
--~----------------------------------------------------------------
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>