'How would I merge two XML documents together using XSLT?

I currently have two data sets, the first being OMDB_data.xml (first snippet) and films_sample.xml (second snippet)

I need to merge the two documents together using XSLT to create the following XML structure: enter image description here

Can somebody please explain how I would go about using elements from two different XML documents to create that structure? sorry if this is a noob question but I've only just started today and my previous exercise only had me using one xml document. XLST version is 1.0

Update - I've been given a framework for the XSLT template/structure, it's below.

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"  
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="no" method="xml"
     encoding="UTF-8" indent="yes" />

    <xsl:template match="root">
        <!-- Add the element for <root></root> -->
            <!--apply the results template-->   
                    <xsl:apply-templates select="results"/>
    </xsl:template>     
    
    <xsl:template match="results">
        There should be 2 copies of this line - one for each result <!-- remove / comment out this line once you have tested the transform is working -->
        
        <!-- Hint: you might find a couple of variables to hold the second documents node set and current film title useful -->
        
        <!-- Create the structure of the output - <movie> </movie> tags -->     
        
        <!-- Output the title and overview tags (with content) from the films sample.xml -->
            
        <!-- For each movie in the OMDB_data.xml file, 
                Does the title match the title in the films sample file?
                    If it does, output the 'imdbid' 'writer' and 'director' as new elements with content -->    
            
        <!-- Output the 'cast' and 'showing-in' tags (with content) from the films sample.xml -->   
        
    </xsl:template> 
</xsl:stylesheet>

<?xml version='1.0' encoding='UTF-8'?>
<root response="True">
<movie title="Bumblebee"
        year="2018"
        rated="PG-13"
        released="21 Dec 2018"
        runtime="114 min"
        genre="Action, Adventure, Sci-Fi"
        director="Travis Knight"
        writer="Christina Hodson, Christina Hodson (story by)"
        actors="Hailee Steinfeld, Jorge Lendeborg Jr., John Cena, Jason Drucker"
        plot="On the run in the year of 1987, Bumblebee finds refuge in a junkyard in a small Californian beach town. Charlie, on the cusp of turning 18 and trying to find her place in the world, discovers Bumblebee, battle-scarred and broken."
        language="English"
        country="USA"
        awards="N/A"
        poster="https://m.media-amazon.com/images/M/MV5BOTM3NzE5OTE1Nl5BMl5BanBnXkFtZTgwNzQwNjM3NjM@._V1_SX300.jpg"
        metascore="66"
        imdbRating="7.2"
        imdbVotes="43,567"
        imdbID="tt4701182"
        type="movie"/>
<movie title="Fantastic Beasts: The Crimes of Grindelwald"
        year="2018"
        rated="PG-13"
        released="16 Nov 2018"
        runtime="134 min"
        genre="Adventure, Family, Fantasy"
        director="David Yates"
        writer="J.K. Rowling, J.K. Rowling (based upon characters created by)"
        actors="Johnny Depp, Kevin Guthrie, Carmen Ejogo, Wolf Roth"
        plot="The second installment of the &quot;Fantastic Beasts&quot; series featuring the adventures of Magizoologist Newt Scamander."
        language="English, French"
        country="UK, USA"
        awards="N/A"
        poster="https://m.media-amazon.com/images/M/MV5BZjFiMGUzMTAtNDAwMC00ZjRhLTk0OTUtMmJiMzM5ZmVjODQxXkEyXkFqcGdeQXVyMDM2NDM2MQ@@._V1_SX300.jpg"
        metascore="52"
        imdbRating="6.8"
        imdbVotes="109,908"
        imdbID="tt4123430"
        type="movie"/>
</root>

I then have films sample.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE root SYSTEM "GC_FILM_DATA.dtd">
<?xml-stylesheet type="text/xsl" href="films.xsl"?>
<root>
    <page>41</page>
    <total_results>4484</total_results>
    <total_pages>225</total_pages>
    <results>
        <vote_count>543</vote_count>
        <id>424783</id>
        <video>false</video>
        <vote_average>6.6</vote_average>
        <title>Bumblebee</title>
        <popularity>401.273</popularity>
        <poster_path>/fw02ONlDhrYjTSZV8XO6hhU3ds3.jpg</poster_path>
        <original_language>en</original_language>
        <original_title>Bumblebee</original_title>
        <genres>
            <genre_ids>28</genre_ids>
            <genre_ids>12</genre_ids>
            <genre_ids>878</genre_ids>
        </genres>
        <cast>
            <cast-member firstName="Hailee" lastName="Steinfeld">
                <character firstName="Charlie" lastName=""></character>
            </cast-member>
            <cast-member firstName="Jorge" lastName="Lendeborg Jr.">
                <character firstName="Memo" lastName=""></character>
            </cast-member>
            <cast-member firstName="John" lastName="Cena">
                <character firstName="Agent" lastName="Burns"></character>
            </cast-member>
        </cast>
        <backdrop_path>/8bZ7guF94ZyCzi7MLHzXz6E5Lv8.jpg</backdrop_path>
        <adult>false</adult>
        <overview>On the run in the year 1987, Bumblebee finds refuge in a junkyard in a small Californian beach town. Charlie, on the cusp of turning 18 and trying to find her place in the world, discovers Bumblebee, battle-scarred and broken.  When Charlie revives him, she quickly learns this is no ordinary yellow VW bug.</overview>
        <release_date>2018-12-21</release_date>
        <showing-in>
            <cinema>Oxford</cinema>
            <cinema>Birmingham</cinema>
            <cinema>London</cinema>
            <cinema>Liverpool</cinema>
            <cinema>Edinburgh</cinema>
        </showing-in>       
    </results>
    <results>
        <vote_count>2726</vote_count>
        <id>338952</id>
        <video>false</video>
        <vote_average>6.9</vote_average>
        <title>Fantastic Beasts: The Crimes of Grindelwald</title>
        <popularity>228.871</popularity>
        <poster_path>/kQKcbJ9uYkTQql2R8L4jTUz7l90.jpg</poster_path>
        <original_language>en</original_language>
        <original_title>Fantastic Beasts: The Crimes of Grindelwald</original_title>
        <genres>
            <genre_ids>10751</genre_ids>
            <genre_ids>14</genre_ids>
            <genre_ids>12</genre_ids>
        </genres>
        <cast>
            <cast-member firstName="Johnny" lastName="Depp">
                <character firstName="" lastName="Grindelwald"></character>
            </cast-member>
            <cast-member firstName="Kevin" lastName="Guthrie">
                <character firstName="" lastName="Abernathy"></character>
            </cast-member>
            <cast-member firstName="Eddie" lastName="Redmayne">
                <character firstName="Newt" lastName="Scamander"></character>
            </cast-member>
        </cast>
        <backdrop_path>/wDN3FIcQQ1HI7mz1OOKYHSQtaiE.jpg</backdrop_path>
        <adult>false</adult>
        <overview>Gellert Grindelwald has escaped imprisonment and has begun gathering followers to his cause—elevating wizards above all non-magical beings. The only one capable of putting a stop to him is the wizard he once called his closest friend, Albus Dumbledore. However, Dumbledore will need to seek help from the wizard who had thwarted Grindelwald once before, his former student Newt Scamander, who agrees to help, unaware of the dangers that lie ahead. Lines are drawn as love and loyalty are tested, even among the truest friends and family, in an increasingly divided wizarding world.</overview>
        <release_date>2018-11-16</release_date>
        <showing-in>
            <cinema>Birmingham</cinema>
            <cinema>Oxford</cinema>         
            <cinema>Leeds</cinema>
            <cinema>London</cinema>
            <cinema>Plymouth</cinema>
        </showing-in>   
    </results>
</root>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source