RE: [xsl] To eliminate duplicate entries

Subject: RE: [xsl] To eliminate duplicate entries
From: <tomas.vanek@xxxxxxxxxxxxx>
Date: Wed, 8 Jun 2005 11:46:40 +0200
XML:
<example>
	<employee name="111"/>
	<employee name="222"/>
	<employee name="111"/>
</example>

XSLT 1.0:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
	<xsl:output method="xml" indent="yes" encoding="utf-8"/>
	<xsl:key name="employee" use="@name" match="/*/employee"/>
	<xsl:template match="/">
		<result>
			<xsl:copy-of
select="*/employee[count(key('employee', @name)[1]|.)=1]"/>
		</result>
	</xsl:template>
</xsl:stylesheet>

Te idea behind the code: Use grouping and select the first occurance.

tomi


-----Original Message-----
From: X.P.Pratibha :-) [mailto:xp_pratibha@xxxxxxxxxx]
Sent: Wednesday, June 08, 2005 11:23 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] To eliminate duplicate entries

Hi all.,
    I am novoice to XSL .

My XML has multiple Duplicate entries and while displaying it through
XSL I have to eliminate the multiple duplicate entries and display only
one entry .

Is there is any way to check the uniqueness of the data to be displayed
in XSL.

In my xml data say if "employee id" is unqui ,Is there anyway to check
the replication of employee id in xsl.

Any links or sample code will be of great help.


Thanks,
Pratibha



This message is for the designated recipient only and may contain privileged,
proprietary, or otherwise private information.  If you have received it in
error, please notify the sender immediately and delete the original.  Any
other use of the email by you is prohibited.

Current Thread