something like
<xsl:stylesheet version="2.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" omit-xml-declaration="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="objects">
<xsl:for-each-group select=".//Nid" group-by=".">
<xsl:copy-of select="current-group()[2]"/>
</xsl:for-each-group>
</xsl:template>
</xsl:stylesheet>
On 7 September 2016 at 10:43, Rahul Singh
rahulsinghindia15(_at_)gmail(_dot_)com <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
Hi,
I have only one XML. and there <Nid> contains same data like 000817441. I
want to throw an email for same data.
How to find out if Xml contains two or more equal element name value with
xsl? But my code is not responding
*Below is XML:*
<?xml version="1.0" encoding="UTF-8"?>
<objects>
<Contact>
<Id>003j000001Cj6l8AAB</Id>
<Nid>000817441</Nid>
</Contact>
<Contact>
<Id>007j000001Cj6l8AAB</Id>
<Nid>000817441</Nid>
</Contact>
<Contact>
<Id>003j700001Cj6l9AAB</Id>
<Nid>001191237</Nid>
</Contact>
<Contact>
<Id>003j000801Cj6lAAAR</Id>
<Nid>010978087</Nid>
</Contact>
<Contact>
<Id>003j000001Cj9l8AAB</Id>
<Nid>000817441</Nid>
</Contact>
</objects>
*Below in XSL:*
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/
1999/XSL/Transform">
<xsl:output method="xml" indent="yes" omit-xml-declaration="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="objects">
<xsl:if
test="boolean(//objects/Contact[./Nid >
preceding-sibling::node() or ./Nid > following-sibling::Nid])">
<Nid>
<xsl:value-of select="Nid"/>
</Nid>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
*Expected output:*
<Nid>000817441</Nid>
XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe <-list/2739265> (by
email <>)
--~----------------------------------------------------------------
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
--~--