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(_at_)HotPOP(_dot_)com]
Sent: Wednesday, June 08, 2005 11:23 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
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.
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--