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