<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Oliver's XSLT page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<meta name="description"
      content="XSLT resource page of Oliver Becker, Department of Computer Science, Humboldt University">
<meta name="keywords"
      content="Oliver Becker, XSLT, XML Transformations, University">
<link rel="stylesheet" type="text/css" href="../Include/style.css">
<link rel="stylesheet" type="text/css" href="xmlverbatim/xmlverbatim.css">
</head>

<body bgcolor="#FFFFEE" link="#CC0000" vlink="#993333" alink="#FF0000">
<font size="-1"><em>
Oliver Becker, System Architecture,
<a href="http://www.informatik.hu-berlin.de/e_index.html">Department of
Computer Science</a>,
<a href="http://www.hu-berlin.de/indexe.html">Humboldt University
Berlin</a>
<font color="#99FFFF">.</font>
</em></font>


<hr size=1 noshade>

<a name="merge"></a>
<h3>Merging two XML Documents</h3>

<em>
Version 1.6 / 2002-07-05
(<a href="merge/changelog.shtml">change log</a>)
<br>
Runs with: 
<img src="/~obecker/Images/ball_red.gif" alt="XT"> 
<img src="/~obecker/Images/ball_purple.gif" alt="Saxon"> 
<img src="/~obecker/Images/ball_green.gif" alt="Xalan"><sup>*</sup>
<br>
(<sup>*</sup>) more or less correctly ... particularly if the input 
documents contain elements with prefixed attributes
</em>

<p>
This transformation sheet merges two XML documents.

<ul>
   <li> <code><a href="merge/merge.xslt">merge.xslt</a></code> -
        (<a href="merge/merge.xslt.html">pretty HTML</a>)
        </li>
</ul>

<p>
What does "<em>merging</em>" mean?
<br>
Consider the following documents:
<p>
<table width="90%" bgcolor="#ffffff" cellpadding=7 cellspacing=0>
<tr><td>
<tt><object>

<!-- converted by xmlverbatim.xsl 1.0.1, (c) O. Becker -->
<div class="xmlverb-default">   <!--<span class="xmlverb-comment"> file1.xml </span>--><br>
   <<span class="xmlverb-element-name">themes</span>><span class="xmlverb-text"><br>
      </span><<span class="xmlverb-element-name">theme</span> <span class="xmlverb-attr-name">id</span>="<span class="xmlverb-attr-content">appl</span>"><span class="xmlverb-text"><br>
         </span><<span class="xmlverb-element-name">title</span> <span class="xmlverb-attr-name">xml:lang</span>="<span class="xmlverb-attr-content">nl</span>"><span class="xmlverb-text">Toepassingen</span></<span class="xmlverb-element-name">title</span>><span class="xmlverb-text"><br>
      </span></<span class="xmlverb-element-name">theme</span>><span class="xmlverb-text"><br>
   </span></<span class="xmlverb-element-name">themes</span>><br>
</div>

</object></tt>
</td></tr>
<tr><td>
<tt><object>

<!-- converted by xmlverbatim.xsl 1.0.1, (c) O. Becker -->
<div class="xmlverb-default">   <!--<span class="xmlverb-comment"> file2.xml </span>--><br>
   <<span class="xmlverb-element-name">themes</span>><span class="xmlverb-text"><br>
      </span><<span class="xmlverb-element-name">theme</span> <span class="xmlverb-attr-name">id</span>="<span class="xmlverb-attr-content">doc</span>" /><span class="xmlverb-text"><br>
      </span><<span class="xmlverb-element-name">theme</span> <span class="xmlverb-attr-name">id</span>="<span class="xmlverb-attr-content">appl</span>"><span class="xmlverb-text"><br>
         </span><<span class="xmlverb-element-name">title</span> <span class="xmlverb-attr-name">xml:lang</span>="<span class="xmlverb-attr-content">en</span>"><span class="xmlverb-text">Applications</span></<span class="xmlverb-element-name">title</span>><span class="xmlverb-text"><br>
      </span></<span class="xmlverb-element-name">theme</span>><span class="xmlverb-text"><br>
   </span></<span class="xmlverb-element-name">themes</span>><br>
</div>

</object></tt>
</td></tr></table>

<p>
After merging these two, the result document will be
<p>
<table width="90%" bgcolor="#ffffff" cellpadding=7 cellspacing=0>
<tr><td>
<tt><object>

<!-- converted by xmlverbatim.xsl 1.0.1, (c) O. Becker -->
<div class="xmlverb-default">   <!--<span class="xmlverb-comment"> file1.xml </span>--><br>
   <!--<span class="xmlverb-comment"> file2.xml </span>--><br>
   <<span class="xmlverb-element-name">themes</span>><span class="xmlverb-text"><br>
      </span><<span class="xmlverb-element-name">theme</span> <span class="xmlverb-attr-name">id</span>="<span class="xmlverb-attr-content">doc</span>" /><span class="xmlverb-text"><br>
      </span><<span class="xmlverb-element-name">theme</span> <span class="xmlverb-attr-name">id</span>="<span class="xmlverb-attr-content">appl</span>"><span class="xmlverb-text"><br>
         </span><<span class="xmlverb-element-name">title</span> <span class="xmlverb-attr-name">xml:lang</span>="<span class="xmlverb-attr-content">nl</span>"><span class="xmlverb-text">Toepassingen</span></<span class="xmlverb-element-name">title</span>><span class="xmlverb-text"><br>
      </span><<span class="xmlverb-element-name">title</span> <span class="xmlverb-attr-name">xml:lang</span>="<span class="xmlverb-attr-content">en</span>"><span class="xmlverb-text">Applications</span></<span class="xmlverb-element-name">title</span>><span class="xmlverb-text"><br>
      </span></<span class="xmlverb-element-name">theme</span>><span class="xmlverb-text"><br>
   </span></<span class="xmlverb-element-name">themes</span>><br>
</div>

</BODY>


</html>