Re: [xsl] Re: How to remove duplicate record from XML

Subject: Re: [xsl] Re: How to remove duplicate record from XML
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 28 Sep 2016 18:42:22 -0000
On 28.09.2016 20:14, Rahul Singh rahulsinghindia15@xxxxxxxxx wrote:
I had tried with new xsl code insted of that for  '*How XSL will work If
we have more then one same record in XML, ignore them and extract only
rest data. my xsl code handling only duplicate value, i need only that
record which is not duplicate or more then one*'. Below is my new XSL:

<xsl:stylesheet version="1.0" xmlns:xsl="w3.org/1999/XSL/Transform
<http://w3.org/1999/XSL/Transform>">; <xsl:output
omit-xml-declaration="yes" indent="yes"/> <xsl:strip-space elements=""/>
<xsl:key name="ccid" match="creations" use="id"/> <xsl:template
match="node() | @"> <xsl:copy> <xsl:apply-templates select="node() |
@*"/> </xsl:copy> </xsl:template> <xsl:template
match="creation[not(generate-id() = generate-id(key('ccid',
creations)[1]))]"/> </xsl:stylesheet>

Use


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">

	<xsl:key name="ccid" match="creation" use="id"/>
	
	<xsl:template match="node() | @*">
		<xsl:copy>
			<xsl:apply-templates select="node() | @*"/>
		</xsl:copy>
	</xsl:template>
	
	<xsl:template match="creation[key('ccid', id)[2]]"/>
	
</xsl:stylesheet>

Current Thread