[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Grouping with Xt
Hi Brian, > 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) Yes, I think so. Since when you're processing the Items they're in PartNumber order, you could do it slightly more efficiently (I think) with: <xsl:for-each select="xt:node-set($sorted)/Items [preceding-sibling::Items[1]/@PartNumber != @PartNumber]"> <!-- this is done once per unique value --> ... <xsl:for-each select="following-sibling::Items [@PartNumber = current()/@PartNumber]"> <!-- this is done for each Items element in the group --> ... </xsl:for-each> ... </xsl:for-each> This should be more efficient because it only checks the immediately-preceding sibling of each Items element to see if the Items element starts (rather than ends) a new group. Plus it only looks at the following siblings to find other Items with the same PartNumber value, rather than *all* the Items elements in the sorted list. > I'm sure I'm not the only one forced to use Xt and required to do > grouping. :-) Out of interest, why are you being forced to use xt? Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ 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
|