xsl-list
[Top] [All Lists]

[xsl] XSL matching and duplication!

2017-08-30 22:27:52
Hi,

i need data from input1.xml check first if clientname/id is matching with
clientdata/name from input2.xml otherwise delete duplication based on
clientname/Email from input1.xml, My duplication is working but i am not
geetitng first condition data:

<xsl:stylesheet version="2.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform";>
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:key name="kBymail" match="clientname" use="Email"/>
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="clientname[Email =
following-sibling::clientname/Email]"/>
</xsl:stylesheet>

Input1.xml:
------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<ClientInfo>
   <clientname>
        <Id>003f40000049yJYAAY</Id>
        <Email>gbc(_at_)gmail(_dot_)com</Email>
     </clientname>
   <clientname>
        <Id>003f40000049z3iAAA</Id>
        <Email>gbc(_at_)gmail(_dot_)com</Email>
     </clientname>
   <clientname>
        <Id>003f40000049z3nAAA</Id>
        <Email>gbc(_at_)gmail(_dot_)com</Email>
     </clientname>
   <clientname>
        <Id>003f40000048uLLAAY</Id>
        <Email>gar(_at_)gmail(_dot_)com</Email>
     </clientname>
   <clientname>
        <Id>003f40000049t38AAA</Id>
        <Email>gad(_at_)gmail(_dot_)com</Email>
     </clientname>
  </objects>

Input2.xml:
---------------------------------------
  <?xml version="1.0" encoding="UTF-8"?>
<ClientInfo>
   <clientdata>
        <name>003f40000048uLLAAY</name>
      <clientnameReference>
           <Email>gar(_at_)gmail(_dot_)com</Email>
        </clientnameReference>
     </clientdata>
   <clientdata>
        <name>003f40000049t38AAA</name>
      <clientnameReference>
           <Email>gad(_at_)gmail(_dot_)com</Email>
        </clientnameReference>
     </clientdata>
   <clientdata>
        <name>003f40000049yJYAAY</name>
      <clientnameReference>
           <Email>gbc(_at_)gmail(_dot_)com</Email>
        </clientnameReference>
     </clientdata>
  </objects>


Expectedoutput:
---------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<ClientInfo>
   <clientname>
        <Id>003f40000049yJYAAY</Id>
        <Name>barcode11</Name>
        <Email>gbc(_at_)gmail(_dot_)com</Email>
     </clientname>
   <clientname>
        <Id>003f40000048uLLAAY</Id>
        <Name>Bob Robben</Name>
        <Email>gar(_at_)gmail(_dot_)com</Email>
     </clientname>
   <clientname>
        <Id>003f40000049t38AAA</Id>
        <Name>ADVT4</Name>
        <Email>gad(_at_)gmail(_dot_)com</Email>
     </clientname>
  </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
--~--
<Prev in Thread] Current Thread [Next in Thread>
  • [xsl] XSL matching and duplication!, Rahul Singh rahulsinghindia15(_at_)gmail(_dot_)com <=