Grouping with Xt
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
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format