[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Duplicates in multiple, independent lists

Subject: Duplicates in multiple, independent lists
From: J-P Stacey <jps@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 25 Feb 2004 16:42:43 +0000 (GMT)
jp stacey
Hi,

I've just been implementing a remove-duplicate template, and had a look
at the suggestions at http://www.dpawson.co.uk/xsl/sect2/N2696.html . The
simplest one for my (reasonably small) data set is at #d3417e34, "Remove
duplicates from a list".

However, after several rewrites weren't working, I noticed that
following:: snarfs the whole of the rest of the document
(http://www.w3schools.com/xpath/xpath_location.asp). Now this is no good
for my data, because there are several sets of lists, separated in the
same file and necessarily treated independently as far as duplication is
concerned. I had to resort to preceding-sibling instead:

<xsl:variable name="no-dupes"
              select="Set/Item/DuplicateBit[
                      not(.=../preceding-sibling::node()/DuplicateBit)]"/>

This traps the context within each Set and prevents duplicate removal
because of later sets. I also used preceding- rather than
following-sibling because it outputs up the first instance of each
duplicate rather than the last, but I suppose that's a matter of taste.

Would it be useful to add this as a caveat to that bit of the FAQ? It's
not as cute as using // and following::, but it might be useful to flag
what (I think) is going on.

Thoughts?

J-P
-- 
Will Self's mobile ring is Smells Like Teen Spirit.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.