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

Re: xsl filtering duplicate nodes

Subject: Re: xsl filtering duplicate nodes
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 29 Mar 2001 14:16:30 +0100
preceding sibling reference
Hi Tom,

> I need to filter out only those nodes which have identical @id and
> @found attributes

One method would be to process all the Reference elements, but within
the template or xsl:for-each test whether there was a preceding
sibling with the same @id and @found as the current one, and only
process the element if there isn't:

   <xsl:if test="not(preceding-sibling::Reference
                       [@id = current()/@id and
                        @found = current()/@found])">
      ...
   </xsl:if>

The other way is to use the Muenchian method and create a key that
indexes the Reference elements based on their @id *and* @found, by
concatenating the two values together:

<xsl:key name="Reference-by-id-and-found"
         match="Reference"
         use="concat(@id, ':', @found)" />

You can then use:

  Reference[count(.|key('Reference-by-id-and-found',
                        concat(@id, ':', @found))[1]) = 1]

to get the unique Reference elements.  My reply to your earlier email
explained how this worked, so I won't repeat it.

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 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.