xsl-list
[Top] [All Lists]

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

2016-09-28 13:42:28
On 28.09.2016 20:14, Rahul Singh rahulsinghindia15(_at_)gmail(_dot_)com 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>


--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>