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

Re: Identifying duplicate nodes within a branch

Subject: Re: Identifying duplicate nodes within a branch
From: Michael Ludwig <mlu@xxxxxxxxxxxxx>
Date: Thu, 13 Nov 2008 15:22:32 +0100
Re:  Identifying duplicate nodes within a branch
Mark Peters schrieb:
Now I'm trying to identify the <column> nodes where duplicate @id
values exist. Where there are duplicates, I'd like to include the
nodes where the @file value is "doc." But the output should also
include the unique column nodes, all of which have a @file value of

Hi Mark,

the following seems to do the trick:

<xsl:stylesheet version="1.0"
  <xsl:output indent="yes"/>
  <xsl:key name="columns-by-id" match="column" use="@id"/>

  <xsl:template match="column[ @file = 'dev' ]">
    <xsl:if test="
      generate-id() =
      generate-id( key( 'columns-by-id', @id)[1])">
        <xsl:apply-templates select="@*|node()"/>

  <xsl:template match="@*|node()">
      <xsl:apply-templates select="@*|node()"/>

Michael Ludwig

Current Thread


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.
First Name
Last Name
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.