[xsl] Grouping with Xt

Subject: [xsl] Grouping with Xt
From: Brian_Williams@xxxxxx
Date: Tue, 13 Nov 2001 18:48:30 -0800

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="."/>

     <!-- 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
               <!-- Now @PartNumber should be a unique value -->
               <xsl:for-each select="//Items[@PartNumber=current
                    <!-- Here I have all Items with the same part number

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


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

Current Thread