This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Removing Duplicates
- To: xsl-list <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Removing Duplicates
- From: owner-xsl-list at lists dot mulberrytech dot com (by way of MulberryTechnologies List Owner)
- Date: Fri, 2 Feb 2001 11:50:29 -0500
- Reply-To: xsl-list at lists dot mulberrytech dot com
From bryan.s.schnabel@exgate.tek.com Thu Feb 1 19:46:28 2001
To: xsl-list@lists.mulberrytech.com
Subject: RE: [xsl] Removing Duplicates
Date: Thu, 1 Feb 2001 16:45:49 -0800
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2448.0)
Content-Type: text/plain;
charset="iso-8859-1"
Jeni's grouping example helped me solve a similar problem
(http://www.jenitennison.com/xslt/grouping/muenchian.html).
But I think you could simplify it a bit to remove duplicates:
<xsl:key name="uq" match="hdl" use="@id" />
<xsl:template match="some-element">
<xsl:for-each select="hdl[count(.|key('uq', @id)[1]) = 1]">
<mod><xsl:value-of select="@id"/></mod>
<xsl:for-each select="key('uq', @id)"/>
</xsl:for-each>
</xsl:template>
-----Original Message-----
From: owner-xsl-list@lists.mulberrytech.com
[mailto:owner-xsl-list@lists.mulberrytech.com]
Sent: Thursday, February 01, 2001 3:40 PM
To: xsl-list
Subject: [xsl] Removing Duplicates
From: Aravind Venkat <AravindV@iS3C.com>
To: "'XSL-List@lists.mulberrytech.com'" <XSL-List@lists.mulberrytech.com>
Subject: Removing Duplicates
Date: Thu, 1 Feb 2001 16:49:43 -0600
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2650.21)
Content-Type: text/plain
Hi All,
I want to remove duplicate nodes by looking at an attribute (in this case
id). Can anyone suggest a good way to do this.
<hdl id="nN14139801"<![CDATA[ORACLE CORP <ORCL.O> TRADES AT $28-1/2, UP FROM
CLOSE OF $27-1/2 ]]></hdl>
<hdl id="nN14139801"<![CDATA[ORACLE CORP <ORCL.O> TRADES AT $28-1/2, UP FROM
CLOSE OF $27-1/2 ]]></hdl>
<hdl id="nN14139812"<![CDATA[MICROSOFT CORP <ORCL.O> TRADES AT $28-1/2, UP
FROM CLOSE OF $27-1/2 ]]></hdl>
Thanks
Aravind Venkat
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list