Compare the files with key/ID node if difference are in Sibling nodes and fetch all nodes

I want to compare the XML node(Key/ID node) and see if their sibling node has any different value than fetch in output from both sections from XML.

Input XML where two XML files are merged

 

 

<?xml version="1.0" encoding="utf-8"?>
<aggregatedData>
    <wd:Report_Data xmlns:wd="urn:report">
        <wd:test>
            <wd:CID>0011</wd:CID>
            <wd:name>Test10</wd:name>
        <wd:tag>TAG2 </wd:tag>
        </wd:test>
        <wd:test>
            <wd:CID>20012</wd:CID>
            <wd:name>Test12</wd:name>
        <wd:tag>TAG2 </wd:tag>
        </wd:test>
        <wd:test>
            <wd:CID>0014</wd:CID>
            <wd:name>Test14</wd:name>
       <wd:tag> TAG3</wd:tag>
        </wd:test>
    </wd:Report_Data>

   <File xmlns="urn:ExternalSource">
        
        <Root1>
            <CID>0011</CID>
            <curre>INR</curre>
            <name>Test1200</name>
        </Root1>
         <Root1>
            <CID>0000</CID>
            <curre>cnd</curre>
            <name>Test00</name>
        </Root1>
        <Root1>
            <CID>20012</CID>
            <curre>INR</curre>
            <name>Test12</name>
        </Root1>
        <Root1>
            <CID>0010</CID>
            <curre>INR</curre>
            <name>why10</name>
        </Root1>
    </File>
    
</aggregatedData>

 

 

Now in the above input file if compare the nodes only "0011" and "20012" are common but a sibling is different in only for "0011".

for 20012(File/Root1/CID and wd:Report_Data/wd:test/wd:CID), subling node value are same in both place. it should not be picked.

for 0011 (File/Root1/CID and wd:Report_Data/wd:test/wd:CID), subling node values are different in both places hence below will be the output along with some of the nodes from the first section from an input file.

 

 

<?xml version="1.0" encoding="utf-8"?>

<FinalFile>
       <Root1>
            <CID>0011</CID>
            <curre>INR</curre>
            <tag>TAG2</tag> <!-- Comment - this is from first section in input file-->

        </Root1>
<FinalFile>

 

 

Tried to use XSLT2.0 and 30 using xsl:accumulator but no luck.

Please anyone can help me here. Thank you!

 

0 0 97
0 REPLIES 0