[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

Subject: Re: 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
Re:  Using xsl:iterate inside <xsl:for-each-group> xslt
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>&#10;</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="&#x9;1.&#x9;Sent the
package to her yesterday."/>
<write_choice num="1" letter="S" term="sentence" item="&#x9;2.&#x9;A history
teacher at the middle school."/>
<write_choice num="2" letter="S" term="sentence" item="&#x9;3.&#x9;Roberto
works on Saturday afternoons."/>
<write_choice num="3" letter="S" term="sentence" item="&#x9;4.&#x9;Skied down
a mountain for the first time."/>
<write_choice num="4" letter="S" term="sentence" item="&#x9;5.&#x9;Since are
going out for dinner."/>
<write_choice num="5" letter="S" term="sentence" item="&#x9;6.&#x9;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="&#x9;1.&#x9;Sent the
package to her yesterday."/>
<write_choice num="1" letter="S" term="sentence" item="&#x9;1.&#x9;Sent the
package to her yesterday."/>
<write_choice num="2" letter="S" term="sentence" item="&#x9;2.&#x9;A history
teacher at the middle school."/>
<write_choice num="3" letter="S" term="sentence" item="&#x9;2.&#x9;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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.