Hi.
I have only one XML. and there <Nid> contains same data like 892828740. I
want get the Id,Updateeddate,Nid for Contact based on Updateeddate if Nid
has more then one same data. Below is my input, XSL, expected output
Below is XML:
<?xml version="1.0" encoding="UTF-8"?>
<objects>
<Contact>
<Id>003j000001DQMkcAAH</Id>
<Updateeddate>2016-09-08T10:31:24.000Z</Updateeddate>
<Nid>892828740</Nid>
</Contact>
<Contact>
<Id>003j000001DQMlXAAX</Id>
<Updateeddate>2016-09-08T10:22:47.000Z</Updateeddate>
<Nid>879284114</Nid>
</Contact>
<Contact>
<Id>003j000001DQMlYAAX</Id>
<Updateeddate>2016-09-08T10:22:47.000Z</Updateeddate>
<Nid>882692370</Nid>
</Contact>
<Contact>
<Id>003j000001DQMlZAAX</Id>
<Updateeddate>2016-09-08T10:22:47.000Z</Updateeddate>
<Nid>892828740</Nid>
</Contact>
</objects>
Below in XSL:
<xsl:stylesheet version="2.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="objects">
<xsl:if test="count(//Contact/Nid[(. =
../following-sibling::Contact/Nid)])">
<Nids>
<Nid>
<Id>
<xsl:value-of
select="//Contact/Nid[(. =
../following-sibling::Contact/Nid)]"/>
</Id>
<updateDate>
<xsl:value-of select="//Updateeddate"/>
</updateDate>
<Nid/>
</Nid>
</Nids>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Expected output:
<objects>
<Contact>
<Id>003j000001DQMkcAAH</Id>
<Updateeddate>2016-09-08T10:31:24.000Z</Updateeddate>
<Nid>892828740</Nid>
</Contact>
<Contact>
<Id>003j000001DQMlXAAX</Id>
<Updateeddate>2016-09-08T10:22:47.000Z</Updateeddate>
<Nid>879284114</Nid>
</Contact>
<Contact>
<Id>003j000001DQMlYAAX</Id>
<Updateeddate>2016-09-08T10:22:47.000Z</Updateeddate>
<Nid>882692370</Nid>
</Contact>
</objects>
--~----------------------------------------------------------------
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
--~--