title: merge two xml using groovy script or xslt
body: <p>I have two xmls and it needs to be merged using groovy for xslt mapping.</p>
  <p>Structure of XML-1:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;EmployeeTime&gt;
      &lt;EmployeeTime&gt;
          &lt;ABC&gt;xyz&lt;/ABC&gt;
          &lt;userId&gt;77&lt;/userId&gt;
          &lt;ABC1&gt;xyz1&lt;/ABC1&gt;
      &lt;/EmployeeTime&gt;
      &lt;EmployeeTime&gt;
          &lt;ABC&gt;xyz&lt;/ABC&gt;
          &lt;userId&gt;78&lt;/userId&gt;
          &lt;ABC1&gt;xyz1&lt;/ABC1&gt;
      &lt;/EmployeeTime&gt;
      &lt;EmployeeTime&gt;
          &lt;ABC&gt;xyz&lt;/ABC&gt;
          &lt;userId&gt;79&lt;/userId&gt;
          &lt;ABC1&gt;xyz1&lt;/ABC1&gt;
      &lt;/EmployeeTime&gt;
  &lt;/EmployeeTime&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>Structure of XML-2 -</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;n0:ZHTR_LEAVE_SAL_ADVANCEResponse xmlns:n0="urn:sap-com:document:sap:rfc:functions"&gt;
           &lt;E_LEAVEDATA&gt;
              &lt;item&gt;
                 &lt;PERNR&gt;00000077&lt;/PERNR&gt;
                 &lt;AMOUNT&gt;0.0&lt;/AMOUNT&gt;
                 &lt;DAYS/&gt;
                 &lt;DATE&gt;2020-02-29&lt;/DATE&gt;
              &lt;/item&gt;
              &lt;item&gt;
                 &lt;PERNR&gt;00000078&lt;/PERNR&gt;
                 &lt;AMOUNT&gt;0.0&lt;/AMOUNT&gt;
                 &lt;DAYS/&gt;
                 &lt;DATE&gt;2020-02-29&lt;/DATE&gt;
              &lt;/item&gt;
              &lt;item&gt;
                 &lt;PERNR&gt;00000078&lt;/PERNR&gt;
                 &lt;AMOUNT&gt;0.0&lt;/AMOUNT&gt;
                 &lt;DAYS/&gt;
                 &lt;DATE&gt;2020-02-29&lt;/DATE&gt;
              &lt;/item&gt;
           &lt;/E_LEAVEDATA&gt;
        &lt;/n0:ZHTR_LEAVE_SAL_ADVANCEResponse&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>I need to merge it and get an response as below -</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;EmployeeTime&gt;
      &lt;EmployeeTime&gt;
          &lt;ABC&gt;xyz&lt;/ABC&gt;
          &lt;userId&gt;
              &lt;PERNR&gt;77&lt;/PERNR&gt;
              &lt;AMOUNT&gt;0.0&lt;/AMOUNT&gt;
              &lt;DAYS/&gt;
              &lt;DATE&gt;2020-02-29&lt;/DATE&gt;
          &lt;/userId&gt;
          &lt;ABC1&gt;xyz1&lt;/ABC1&gt;
      &lt;/EmployeeTime&gt;
      &lt;EmployeeTime&gt;
          &lt;ABC&gt;xyz&lt;/ABC&gt;
          &lt;userId&gt;
              &lt;PERNR&gt;78&lt;/PERNR&gt;
              &lt;AMOUNT&gt;0.0&lt;/AMOUNT&gt;
              &lt;DAYS/&gt;
              &lt;DATE&gt;2020-02-29&lt;/DATE&gt;
          &lt;/userId&gt;
          &lt;ABC1&gt;xyz1&lt;/ABC1&gt;
      &lt;/EmployeeTime&gt;
      &lt;EmployeeTime&gt;
          &lt;ABC&gt;xyz&lt;/ABC&gt;
          &lt;userId&gt;
              &lt;PERNR&gt;79&lt;/PERNR&gt;
              &lt;AMOUNT&gt;0.0&lt;/AMOUNT&gt;
              &lt;DAYS/&gt;
              &lt;DATE&gt;2020-02-29&lt;/DATE&gt;
          &lt;/userId&gt;
          &lt;ABC1&gt;xyz1&lt;/ABC1&gt;
      &lt;/EmployeeTime&gt;
  &lt;/EmployeeTime&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>The merged response should enrich the the userId tag inside the XML-1</p>
  <p>Please note that the  can be repeated n-times and same applies for </p>
  <p>Can some help me with the code XSLT or groovy?</p>
  <p>Regards,
  Akash</p>