This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Grouping with Xt
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] Grouping with Xt
- From: Brian_Williams at i2 dot com
- Date: Tue, 13 Nov 2001 18:48:30 -0800
- Reply-to: xsl-list at lists dot mulberrytech dot com
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