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: "Terry Ofner tdofner@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 13 Aug 2020 20:59:40 -0000
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?

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

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

I get a vague sense of how this works. More reading is in store. For sure.

Thanks.




> On Aug 13, 2020, at 3:55 PM, Martin Honnen martin.honnen@xxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> <xsl:template match="set[p[@class = 'nl']]">
>    <xsl:variable name="groups" as="map(xs:string, element())*">
>      <xsl:for-each-group select="p[@class = 'directions']/*"
> group-starting-with="span[@class = 'letter']">
>        <xsl:sequence select="map { 'letter' : ., 'term' :
> current-group()[2] }"/>
>      </xsl:for-each-group>
>    </xsl:variable>
>    <write_choices>
>      <xsl:iterate select="p[@class = 'nl'] ! $groups">
>        <write_choice num="{position() - 1}" letter="{?letter}"
> term="{?term}"/>
>      </xsl:iterate>
>    </write_choices>
>  </xsl:template>

Current Thread