title: append data ton an element, based on matching this exact element
body: <p>Given the following XML as input,</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;TABLE NAME="TABLE.DB"&gt;
      &lt;DATA RECORDS="2"&gt;
          &lt;RECORD ID="4"&gt;
              &lt;RECNO&gt;0&lt;/RECNO&gt;
              &lt;SEQ&gt;0&lt;/SEQ&gt;
              &lt;DATE&gt;17/12/1999 2:44:08 μμ&lt;/DATE&gt;
              &lt;ID&gt;12/11/2015 3:15:25 μμ&lt;/ID&gt;
              &lt;NUMBER&gt;10354&lt;/NUMBER&gt;
              &lt;CN&gt;PL&lt;/CN&gt;
              &lt;PROPERTY&gt;0&lt;/PROPERTY&gt;
              &lt;DAYS&gt;0&lt;/DAYS&gt;
              &lt;CURRENTSTATUS&gt;0&lt;/CURRENTSTATUS&gt;
              &lt;TOTALS&gt;1&lt;/TOTALS&gt;
          &lt;/RECORD&gt;
          &lt;RECORD ID="3"&gt;
              &lt;RECNO&gt;1&lt;/RECNO&gt;
              &lt;SEQ&gt;0&lt;/SEQ&gt;
              &lt;DATE&gt;17/12/1999 2:44:08 μμ&lt;/DATE&gt;
              &lt;ID&gt;12/11/2015 3:15:25 μμ&lt;/ID&gt;
              &lt;NUMBER&gt;10355&lt;/NUMBER&gt;
              &lt;CN&gt;PL&lt;/CN&gt;
              &lt;PROPERTY&gt;0&lt;/PROPERTY&gt;
              &lt;DAYS&gt;0&lt;/DAYS&gt;
              &lt;CURRENTSTATUS&gt;0&lt;/CURRENTSTATUS&gt;
              &lt;TOTALS&gt;1&lt;/TOTALS&gt;
          &lt;/RECORD&gt;
          &lt;RECORD ID="2"&gt;
              &lt;RECNO&gt;2&lt;/RECNO&gt;
              &lt;SEQUENCE&gt;0&lt;/SEQUENCE&gt;
              &lt;DATE&gt;17/12/1999 2:44:08 μμ&lt;/DATE&gt;
              &lt;ID&gt;12/11/2015 3:15:25 μμ&lt;/ID&gt;
              &lt;NUMBER&gt;10356&lt;/NUMBER&gt;
              &lt;CN&gt;PL 300 L&lt;/CN&gt;
              &lt;PROPERTY&gt;0&lt;/PROPERTY&gt;
              &lt;DAYS&gt;10&lt;/DAYS&gt;
              &lt;CURRENTSTATUS&gt;0&lt;/CURRENTSTATUS&gt;
              &lt;SUB_A&gt;Some random data not matched.&lt;/SUB_A&gt;
          &lt;/RECORD&gt;
          &lt;RECORD ID="1"&gt;
              &lt;RECNO&gt;3&lt;/RECNO&gt;
              &lt;SEQUENCE&gt;0&lt;/SEQUENCE&gt;
              &lt;DATE&gt;17/12/1999 2:44:08 μμ&lt;/DATE&gt;
              &lt;ID&gt;12/11/2015 3:15:25 μμ&lt;/ID&gt;
              &lt;NUMBER&gt;10357&lt;/NUMBER&gt;
              &lt;CN&gt;PL 300 L&lt;/CN&gt;
              &lt;PROPERTY&gt;0&lt;/PROPERTY&gt;
              &lt;DAYS&gt;10&lt;/DAYS&gt;
              &lt;CURRENTSTATUS&gt;0&lt;/CURRENTSTATUS&gt;
              &lt;TOTALS&gt;19837&lt;/TOTALS&gt;
          &lt;/RECORD&gt;
          &lt;RECORD ID="0"&gt;
              &lt;RECNO&gt;3&lt;/RECNO&gt;
              &lt;SEQUENCE&gt;0&lt;/SEQUENCE&gt;
              &lt;DATE&gt;17/12/1999 2:44:08 μμ&lt;/DATE&gt;
              &lt;ID&gt;12/11/2015 3:15:25 μμ&lt;/ID&gt;
              &lt;NUMBER&gt;10358&lt;/NUMBER&gt;
              &lt;CN&gt;PL 300 L&lt;/CN&gt;
              &lt;PROPERTY&gt;0&lt;/PROPERTY&gt;
              &lt;DAYS&gt;10&lt;/DAYS&gt;
              &lt;CURRENTSTATUS&gt;0&lt;/CURRENTSTATUS&gt;
          &lt;/RECORD&gt;
      &lt;/DATA&gt;
  &lt;/TABLE&gt;
  </code></pre>
  
  <p>and the following tab separated file:</p>
  
  <pre><code>[yet another value.]\t10358
  value i'd like to add\t10355
  (another) value i'd like to add\t10357
  </code></pre>
  
  <p>i used \t, in order to show where the tab exists in the file. i would like to append the data found in the first column, into the element i try to match on, which in this case in NUMBER.</p>
  
  <p>So if NUMBER equals second column, append to it the value found in the first column, using | as a separator.</p>
  
  <p>how one could have the below result, but with keeping the order of the records, sorting on the  element Output:</p>
  
  <pre><code>     &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;TABLE NAME="TABLE.DB"&gt;
      &lt;DATA RECORDS="2"&gt;
            &lt;RECORD ID="0"&gt;
              &lt;RECNO&gt;3&lt;/RECNO&gt;
              &lt;SEQUENCE&gt;0&lt;/SEQUENCE&gt;
              &lt;DATE&gt;17/12/1999 2:44:08 μμ&lt;/DATE&gt;
              &lt;ID&gt;12/11/2015 3:15:25 μμ&lt;/ID&gt;
              &lt;NUMBER&gt;10358 | [yet another value.]&lt;/NUMBER&gt;
              &lt;CN&gt;PL 300 L&lt;/CN&gt;
              &lt;PROPERTY&gt;0&lt;/PROPERTY&gt;
              &lt;DAYS&gt;10&lt;/DAYS&gt;
              &lt;CURRENTSTATUS&gt;0&lt;/CURRENTSTATUS&gt;
          &lt;/RECORD&gt;
          &lt;RECORD ID="1"&gt;
              &lt;RECNO&gt;3&lt;/RECNO&gt;
              &lt;SEQUENCE&gt;0&lt;/SEQUENCE&gt;
              &lt;DATE&gt;17/12/1999 2:44:08 μμ&lt;/DATE&gt;
              &lt;ID&gt;12/11/2015 3:15:25 μμ&lt;/ID&gt;
              &lt;NUMBER&gt;10357 | (another) value i'd like to add&lt;/NUMBER&gt;
              &lt;CN&gt;PL 300 L&lt;/CN&gt;
              &lt;PROPERTY&gt;0&lt;/PROPERTY&gt;
              &lt;DAYS&gt;10&lt;/DAYS&gt;
              &lt;CURRENTSTATUS&gt;0&lt;/CURRENTSTATUS&gt;
              &lt;TOTALS&gt;19837&lt;/TOTALS&gt;
          &lt;/RECORD&gt;
          &lt;RECORD ID="2"&gt;
              &lt;RECNO&gt;2&lt;/RECNO&gt;
              &lt;SEQUENCE&gt;0&lt;/SEQUENCE&gt;
              &lt;DATE&gt;17/12/1999 2:44:08 μμ&lt;/DATE&gt;
              &lt;ID&gt;12/11/2015 3:15:25 μμ&lt;/ID&gt;
              &lt;NUMBER&gt;10356&lt;/NUMBER&gt;
              &lt;CN&gt;PL 300 L&lt;/CN&gt;
              &lt;PROPERTY&gt;0&lt;/PROPERTY&gt;
              &lt;DAYS&gt;10&lt;/DAYS&gt;
              &lt;CURRENTSTATUS&gt;0&lt;/CURRENTSTATUS&gt;
              &lt;SUB_A&gt;Some random data not matched.&lt;/SUB_A&gt;
          &lt;/RECORD&gt;
          &lt;RECORD ID="3"&gt;
              &lt;RECNO&gt;1&lt;/RECNO&gt;
              &lt;SEQ&gt;0&lt;/SEQ&gt;
              &lt;DATE&gt;17/12/1999 2:44:08 μμ&lt;/DATE&gt;
              &lt;ID&gt;12/11/2015 3:15:25 μμ&lt;/ID&gt;
              &lt;NUMBER&gt;10355 | value i'd like to add&lt;/NUMBER&gt;
              &lt;CN&gt;PL&lt;/CN&gt;
              &lt;PROPERTY&gt;0&lt;/PROPERTY&gt;
              &lt;DAYS&gt;0&lt;/DAYS&gt;
              &lt;CURRENTSTATUS&gt;0&lt;/CURRENTSTATUS&gt;
              &lt;TOTALS&gt;1&lt;/TOTALS&gt;
          &lt;/RECORD&gt;
           &lt;RECORD ID="4"&gt;
              &lt;RECNO&gt;0&lt;/RECNO&gt;
              &lt;SEQ&gt;0&lt;/SEQ&gt;
              &lt;DATE&gt;17/12/1999 2:44:08 μμ&lt;/DATE&gt;
              &lt;ID&gt;12/11/2015 3:15:25 μμ&lt;/ID&gt;
              &lt;NUMBER&gt;10354&lt;/NUMBER&gt;
              &lt;CN&gt;PL&lt;/CN&gt;
              &lt;PROPERTY&gt;0&lt;/PROPERTY&gt;
              &lt;DAYS&gt;0&lt;/DAYS&gt;
              &lt;CURRENTSTATUS&gt;0&lt;/CURRENTSTATUS&gt;
              &lt;TOTALS&gt;1&lt;/TOTALS&gt;
          &lt;/RECORD&gt;
      &lt;/DATA&gt;
  &lt;/TABLE&gt;
  </code></pre>
  
  <p>I use Saxon latest, v 9.8</p>