Re: preceding-sibling in a group

"Martin Honnen [email protected]" <[email protected]> Thu, 20 May 2021 20:35:57 -0000
Newsgroups gmane.text.xml.xsl.general.mulberrytech
Organization Liberty Development
Message-ID <[email protected]>
On 20.05.2021 22:20, [email protected] wrote:
> The idea is that when I see a =93NOTE=94 string, I want that entry and all
> following within the same group to be <note> elements. So I am look for
> preceding-sibling or self that contains =93NOTE=94 but restricted to the
> same group. I am using XSLT 3. Thank you very much.

Perhaps using an inner group-starting-with:

   <xsl:template match=3D"dataroot">
     <root>
       <xsl:for-each-group select=3D"*" group-by=3D"FIG_NO">
         <entry>
           <figure>{current-grouping-key()}</figure>
           <xsl:for-each-group select=3D"current-group()"
group-starting-with=3D"*[PART_DES[matches(., 'NOTE')]]">
             <xsl:choose>
               <xsl:when test=3D"self::*[PART_DES[matches(., 'NOTE')]]">
                 <xsl:iterate select=3D"current-group()">
                   <note>{PART_DES}</note>
                 </xsl:iterate>
               </xsl:when>
               <xsl:otherwise>
                 <xsl:iterate select=3D"current-group()">
                   <description>{PART_DES}</description>
                 </xsl:iterate>
               </xsl:otherwise>
             </xsl:choose>
           </xsl:for-each-group>
         </entry>
       </xsl:for-each-group>
     </root>
   </xsl:template>
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/3329386
or by email: [email protected]
--~--