xsl-list
[Top] [All Lists]

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

2020-08-13 15:59:47
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?

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

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

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(_dot_)honnen(_at_)gmx(_dot_)de 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 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>
--~----------------------------------------------------------------
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>