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

Re: preceding-sibling in a group

Subject: Re: preceding-sibling in a group
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 20 May 2021 20:35:52 -0000
Re:  preceding-sibling in a group
On 20.05.2021 22:20, rick@xxxxxxxxxxxxxx wrote:
The idea is that when I see a NOTE 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 NOTE 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="dataroot">
    <root>
      <xsl:for-each-group select="*" group-by="FIG_NO">
        <entry>
          <figure>{current-grouping-key()}</figure>
          <xsl:for-each-group select="current-group()"
group-starting-with="*[PART_DES[matches(., 'NOTE')]]">
            <xsl:choose>
              <xsl:when test="self::*[PART_DES[matches(., 'NOTE')]]">
                <xsl:iterate select="current-group()">
                  <note>{PART_DES}</note>
                </xsl:iterate>
              </xsl:when>
              <xsl:otherwise>
                <xsl:iterate select="current-group()">
                  <description>{PART_DES}</description>
                </xsl:iterate>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:for-each-group>
        </entry>
      </xsl:for-each-group>
    </root>
  </xsl:template>

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.