xsl-list
[Top] [All Lists]

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

2020-08-18 12:04:19
Yep.That does it. I did learn some things about map:merge and use-first, 
use-last, and combine. 

Thanks again for all your help.

t.o.

On Aug 18, 2020, at 12:37 PM, Martin Honnen 
martin(_dot_)honnen(_at_)gmx(_dot_)de 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

Am 18.08.2020 um 18:14 schrieb Terry Ofner tdofner(_at_)gmail(_dot_)com 
<mailto:tdofner(_at_)gmail(_dot_)com>:
Interesting tangle I am in. I tried the map:merge in both the iterate
and apply-templates solutions. I can indeed reference the ‘p’ and pull
it into the output. However, it seems to play havoc with the $groups
output. Here is the changed iterate:

                     <xsl:iterateselect="p[@class = 'nl'] !
map:merge(($groups, map
                        { 'p' : . }))">
<xsl:text>&#10;</xsl:text>
<write_choice  num="{position() - 1}"letter="{?letter}"
                            term="{?term}"item="{?p}"/>
</xsl:iterate>

Yes, sorry, I got lost in my own suggestion, the right code should be

<xsl:apply-templates
       select="for $p in p[@class = 'nl']
               return $groups
                      !
                      map:merge(
                        ($groups,
                         map { 'p' : $p })
                      )"/>

or the same expression for the iterate.

$groups is a sequence of maps we want to process for each "p" and
including the "p" in each map of the sequence is what we need, not to
merge the sequence of maps.




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