This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Grouping with Xt
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: Brian_Williams at i2 dot com
- Cc: xsl-list at lists dot mulberrytech dot com
- Date: Wed, 14 Nov 2001 14:30:49 +0000
- Subject: Re: [xsl] Grouping with Xt
- Organization: Jeni Tennison Consulting Ltd
- References: <OFD7F608DF.C8E2AE89-ON88256B04.000E496F@i2.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
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