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

removing duplicates from a sequence while retaining or

Subject: removing duplicates from a sequence while retaining order
From: "Birnbaum, David J" <djbpitt@xxxxxxxx>
Date: Mon, 8 Oct 2012 20:32:19 -0400
 removing duplicates from a sequence while retaining or
Dear XSLT list,

Is there an easy way in XPath (not using XSLT instructions) to select only the
first occurrence of a specific value in a sequence of atomic values, so as to
return the sequence in the original order, but with re-occurrences of each
value after the first appearance of that value removed? For example, given an
input sequence:

	('Matthew','Mark','Luke','Matthew','John')

I want to produce

	('Matthew','Mark','Luke','John')

I can't rely on using distinct-values() because that isn't guaranteed to keep
specifically the *first* occurrence of a value.

In an XSLT context I can construct a temporary tree, poke each value into an
element, all on the same level in the hierarchy, and then test for:

*[not(preceding-sibling::* = .)]

but I don't know how to write an XPath predicate that will filter the sequence
of *atomic values* the way I want. Is this just a blind spot? Can anyone
advise?

Thanks,

David
djbpitt@xxxxxxxxx

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.