title: Merge 2 XML files based on attribute values using XSLT?
body: <h2>file1.xml</h2>
  
  <pre><code>&lt;config&gt;
   &lt;state version="10"&gt;
    &lt;root value="100" group="5"&gt;
       &lt;leaf number = "2"/&gt;
    &lt;/root&gt;
    &lt;root value="101" group="6"&gt;
       &lt;leaf number = "3"/&gt;
    &lt;/root&gt;
   &lt;/state&gt;
  &lt;/config&gt;
  </code></pre>
  
  <h2>file2.xml</h2>
  
  <pre><code>&lt;config&gt;
   &lt;state version="10"&gt;
    &lt;root value="100" group="5"&gt;
       &lt;leaf number = "6"/&gt;
    &lt;/root&gt;
    &lt;root value="101" group="6"&gt;
       &lt;leaf number = "4"/&gt;
    &lt;/root&gt;
   &lt;/state&gt;
  &lt;/config&gt;
  </code></pre>
  
  <h2>output.xml</h2>
  
  <pre><code>&lt;config&gt;
   &lt;state version="10"&gt;
    &lt;root value="100" group="5"&gt;
       &lt;leaf number = "2"/&gt;
       &lt;leaf number = "6"/&gt;
    &lt;/root&gt;
    &lt;root value="101" group="6"&gt;
       &lt;leaf number = "3"/&gt;
       &lt;leaf number = "4"/&gt;
    &lt;/root&gt;
   &lt;/state&gt;
  &lt;/config&gt;
  </code></pre>
  
  <p>I tried writing an XSLT based on the answer here:
  <a href="https://stackoverflow.com/questions/14699422/how-to-merge-2-xml-files-with-common-nodes-using-xslt/14699483#14699483">How to merge 2 XML files with common nodes using XSLT?</a></p>
  
  <p>but I do not know how to compare based on attribute values (in this case, attributes value and group of 'root' tag? Can someone please help?</p>