This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: removing duplicate children
- To: xsl-list at mulberrytech dot com
- Subject: RE: removing duplicate children
- From: Cliff Draper <Cliff dot Draper at sun dot com>
- Date: Fri, 01 Dec 2000 17:07:39 -0800
- References: <6B2A5AEA929FD411AE41009027CA88E31D43E2@WWMESSD048>
- Reply-To: xsl-list at mulberrytech dot com
From: Kay Michael <Michael.Kay@icl.com>
Date: Fri, 1 Dec 2000 11:47:06 -0000
> > I want to iterate thru a list of nodes that I select and only print
> > out the unique ones. This is different from what I've seen in the FAQ
> > since I want unique values only from the current node and below it.
>
> This makes it difficult because neither the preceding nor the
> preceding-sibling axis gives you the right answer. I'd suggest using
> Muenchian grouping with generate-id() of the "owning" node as part of the
> key value. See www.jenitennison.com.
>
> Mike Kay
Well, I tried that, several other permutations, and couldn't get
anywhere. I did figure out a way to solve the problem though. I use
my for-each to build up a string which is then passed to a template I
call uniq. The parameter passed in looks something like:
|z|a|b|c|a|b|c|b|b|y|z|
That is, a "string list" with '|' as a separator. My uniq template
uses the string functions substring-before, substring-after, &
contains to recursively make that into a unique list.
That's a lot of work for such a simple thing (simple in procedural
languages). But at least I've got something working now.
regards,
Cliff Draper Sun Microsystems, Forte Tools (510) 869-3462 or x73462
My opinions may or may not reflect those of my employer.
---------------------------- food for thought ---------------------------
The chief cause of problems is solutions.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list