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

Grouping with Xt

Subject: Grouping with Xt
From: Brian_Williams@xxxxxx
Date: Tue, 13 Nov 2001 18:48:30 -0800
xsl tutorial following sibling
Hi,

Is this going to do what I *want* it to do?  8^)

Specifically, pick all the Items that have the same PartNumber as the
current node?  (see inner comments)

     <!-- Create a variable that contains all the Items, sorted by
PartNumber -->
     <xsl:variable name="sorted">
          <xsl:for-each select="Items">
               <xsl:sort select="@PartNumber" order="ascending" />
               <xsl:copy-of select="."/>
          </xsl:for-each>
     </xsl:variable>

     <!-- Transform the variable into a node set using special xt extension
-->
     <xsl:for-each select="xt:node-set($sorted)/Items">
          <!-- Do I have the same part number as my following sibling? -->
          <xsl:if test="not(following-sibling::Items/@PartNumber
=@PartNumber)">
               <!-- Now @PartNumber should be a unique value -->
               <xsl:for-each select="//Items[@PartNumber=current
()/@PartNumber]">
                    <!-- Here I have all Items with the same part number
-->
               </xsl:for-each>
          </xsl:if>
     </xsl:for-each>

I'm sure I'm not the only one forced to use Xt and required to do grouping.
:-)

Thanks,
Brian



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.