|
Subject: Re: [xsl] Using xsl:iterate inside <xsl:for-each-group> xslt 3.0 From: "Terry Ofner tdofner@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 18 Aug 2020 16:14:00 -0000 |
Interesting tangle I am in. I tried the map:merge in both the iterate and
apply-templates solutions. I can indeed reference the bpb and pull it into
the output. However, it seems to play havoc with the $groups output. Here is
the changed iterate:
<xsl:iterate select="p[@class = 'nl'] !
map:merge(($groups, map
{ 'p' : . }))">
<xsl:text> </xsl:text>
<write_choice num="{position() - 1}"
letter="{?letter}"
term="{?term}" item="{?p}"/>
</xsl:iterate>
Output:
<write_choice num="0" letter="S" term="sentence" item="	1.	Sent the
package to her yesterday."/>
<write_choice num="1" letter="S" term="sentence" item="	2.	A history
teacher at the middle school."/>
<write_choice num="2" letter="S" term="sentence" item="	3.	Roberto
works on Saturday afternoons."/>
<write_choice num="3" letter="S" term="sentence" item="	4.	Skied down
a mountain for the first time."/>
<write_choice num="4" letter="S" term="sentence" item="	5.	Since are
going out for dinner."/>
<write_choice num="5" letter="S" term="sentence" item="	6.	George does
twenty push-ups each morning.b/>
I was naive to think that it would read my mind and output something like
this:
<write_choice num="0" letter="S" term="sentence" item="	1.	Sent the
package to her yesterday."/>
<write_choice num="1" letter="S" term="sentence" item="	1.	Sent the
package to her yesterday."/>
<write_choice num="2" letter="S" term="sentence" item="	2.	A history
teacher at the middle school."/>
<write_choice num="3" letter="S" term="sentence" item="	2.	A history
teacher at the middle school."/>
Maybe I need to do something different with the ?p call?
> If you need the item on the left side of ! then include it in a merged
> group, for instance
>
> <xsl:iterate select="p[@class = 'nl'] ! map:merge(($groups, map
> { 'p' : . }))">
>
> then the expression ?p inside the iterate selects the property named "p"
> of the map which holds the "p" element.
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Using xsl:iterate inside , Martin Honnen martin | Thread | Re: [xsl] Using xsl:iterate inside , Martin Honnen martin |
| Re: [xsl] Using xsl:iterate inside , Martin Honnen martin | Date | Re: [xsl] Using xsl:iterate inside , Martin Honnen martin |
| Month |