title: Combining 2 XML files into 1 using XSL
body: <p>I'm having trouble finding a suitable example to merge 2 XML files into 1, as per below:</p>
  
  <p>movies.xml</p>
  
  <pre><code>&lt;movies&gt;
      &lt;movie&gt;
          &lt;name&gt;ET&lt;/name&gt;
          &lt;director&gt;Steven Spielberg&lt;/director&gt;
          &lt;date&gt;15 January 2000&lt;/date&gt;
      &lt;/movie&gt;
      &lt;movie&gt;
          &lt;name&gt;The Neverending Story&lt;/name&gt;
          &lt;director&gt;Steven Spielberg&lt;/director&gt;
          &lt;date&gt;4 November 2006&lt;/date&gt;
      &lt;/movie&gt;
  &lt;/movies&gt;
  </code></pre>
  
  <p>directos.xml</p>
  
  <pre><code>&lt;directors&gt;
      &lt;director&gt;
          &lt;name&gt;Steven Spielberg&lt;/name&gt;
          &lt;age&gt;55&lt;/age&gt;
          &lt;sex&gt;male&lt;/sex&gt;
      &lt;/director&gt;
  &lt;/directors&gt;
  </code></pre>
  
  <p>required output:</p>
  
  <pre><code>&lt;directors&gt;
      &lt;director&gt;
          &lt;name&gt;Steven Spielberg&lt;/name&gt;
          &lt;age&gt;55&lt;/age&gt;
          &lt;sex&gt;male&lt;/sex&gt;
          &lt;movies&gt;
              &lt;movie&gt;
                  &lt;name&gt;ET&lt;/name&gt;
                  &lt;date&gt;15 January 2000&lt;/date&gt;
              &lt;/movie&gt;
              &lt;movie&gt;
                  &lt;name&gt;The Neverending Story&lt;/name&gt;
                  &lt;date&gt;4 November 2006&lt;/date&gt;
              &lt;movie&gt;
          &lt;/movies&gt;
      &lt;/director&gt;
  &lt;/directors&gt;
  </code></pre>
  
  <p>XSL:</p>
  
  
  
  <pre><code>&lt;xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
      &lt;xsl:output method = "xml" indent = "yes" /&gt; 
  
      &lt;xsl:variable name="movieFile" select="document('movies.xml')" /&gt;
  
      &lt;xsl:template match="@*|node()"&gt;
          &lt;xsl:copy&gt;
              &lt;xsl:apply-templates select="@*|node()"/&gt;
        &lt;/xsl:copy&gt;
      &lt;/xsl:template&gt;
  
      &lt;xsl:template match="$movieFile/movies/movie/director"&gt;
          &lt;xsl:copy&gt;
              &lt;xsl:apply-templates /&gt;
        &lt;/xsl:copy&gt;
      &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>At the moment, it is printing the whole director list within each movie group.</p>
  
  <p>Can somebody please give me some guidance?</p>