Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to merge two XML files
    primarykey
    data
    text
    <p>I have two xml files, which need to be merged into one xml. Here is the example: </p> <p>orginal.xml file :</p> <pre><code>&lt;employees&gt; &lt;employee id="1"&gt; &lt;name&gt; Name1 &lt;/name&gt; &lt;email&gt; email1 &lt;email&gt; &lt;/employee&gt; &lt;employee id="2"&gt; &lt;name&gt; Name2 &lt;/name&gt; &lt;email&gt; email2 &lt;email&gt; &lt;/employee&gt; &lt;/employees&gt; </code></pre> <p>update.xml file:</p> <pre><code>&lt;employees&gt; &lt;employee id="2"&gt; &lt;name&gt; Name2 &lt;/name&gt; &lt;email&gt; email_New &lt;email&gt; &lt;/employee&gt; &lt;employee id="3"&gt; &lt;name&gt; Name3 &lt;/name&gt; &lt;email&gt; email3 &lt;email&gt; &lt;/employee&gt; &lt;/employees&gt; </code></pre> <p>they should be merged to a xml file like this: </p> <pre><code>&lt;employees&gt; &lt;employee id="1"&gt; &lt;name&gt; Name1 &lt;/name&gt; &lt;email&gt; email1 &lt;email&gt; &lt;/employee&gt; &lt;employee id="2"&gt; &lt;name&gt; Name2 &lt;/name&gt; &lt;email&gt; email_New &lt;email&gt; &lt;/employee&gt; &lt;employee id="3"&gt; &lt;name&gt; Name3 &lt;/name&gt; &lt;email&gt; email3 &lt;email&gt; &lt;/employee&gt; &lt;/employees&gt; </code></pre> <p>Actually, I'd like to use the update.xml to update the orginal.xml : </p> <ol> <li><p>new employee in update.xml should be added to original.xml</p></li> <li><p>modified employee information in update.xml should overwrite the corresponding employee node.</p></li> </ol> <p>I know a little of XSLT, but my knowledge is not enough to figure out the right XSLT for the merge.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload