[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

How to find out if Xml contains two or more equal elem

Subject: How to find out if Xml contains two or more equal element name value with xsl
From: "Rahul Singh rahulsinghindia15@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 7 Sep 2016 10:39:01 -0000
 How to find out if Xml contains two or more equal elem
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 &gt;
preceding-sibling::node() or ./Nid &gt; following-sibling::Nid])">
            <Nid>
                <xsl:value-of select="Nid"/>
            </Nid>
        </xsl:if>
    </xsl:template>
</xsl:stylesheet>

*Expected output:*

<Nid>000817441</Nid>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.