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

RE: Grouping - starting with certain element and endin

Subject: RE: Grouping - starting with certain element and ending before certain elements
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 5 Oct 2005 13:34:35 +0100
idm kay
> So I want to keep the order of all elements but group each <IDM>
> element followed by a number of siblings up to another <IDM>, a <LV2>
> or a <LV3> element and wrap this sequence in a <phrase> section. 


The XSLT 2.0 solution that comes to mind is:

<xsl:for-each-group group-starting-with="IDM|LV2|LV3">
  <xsl:choose>
  <xsl:when test="self::IDM">
    <phrase>
      <xsl:copy-of select="current-group()"/>
    </phrase>
  </xsl:when>
  <xsl:otherwise>
    <xsl:copy-of select="current-group()"/>
  </xsl:otherwise>
  </xsl:choose>
</xsl:for-each-group>

Michael Kay
http://www.saxonica.com/

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.