[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: question with using Muenchian/xsl:key (Re: sort/group/count probl em)
Subject: Re: question with using Muenchian/xsl:key (Re: sort/group/count probl em) From: Mike Brown <mike@xxxxxxxx> Date: Sat, 11 Nov 2000 13:05:24 -0700 (MST) |
Xu, Xiaocun wrote: > Thanks to Jeni's suggestion, I started to apply Muenchian for grouping. > It works well, but I have one problem: since xsl:key is top-level element, I > can not seem to apply element scope with it. This is *exactly* my problem with xsl:key. The only way to restrict your key lookup to a certain node-set is to find the intersection of that node-set and the result of a key lookup across the whole current node's document. The "Kaysian Method" of finding node-set intersections is: $set1[count(.|$set2)=count($set2)] With your data, the indicated section will be $set1: <xsl:for-each select="item[count(. | key('items-by-itemid', @itemid)[1]) =1]"> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ And you'll need to prepare a variable for $set2 right before that: <xsl:variable name="this_lists_items" select="item"/> So the for-each should look like (and I haven't tested this): <xsl:for-each select="item[count(.|key('items-by-itemid',@itemid)[count(.|$this_lists_items)=count($this_lists_items)][1])=1]"> Clear as mud, eh? - Mike ____________________________________________________________________ Mike J. Brown, software engineer at My XML/XSL resources: webb.net in Denver, Colorado, USA http://www.skew.org/xml/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
question with using Muenchian/xsl:k, Xu, Xiaocun | Thread | Re: question with using Muenchian/x, David Carlisle |
RE: XPath help, edmund mitchell | Date | RE: How do I access the XML documen, ciaran byrne |
Month |