Copy.xml

<?xml version="1.0" encoding="UTF-8"?>

<?xml-stylesheet type="text/xsl" href="copy.xsl"?>

<root>

    <cinema id="1">

    <film>Predestination</film>

    <director>Spierig Brothers</director>

    <year>2014</year>

    </cinema>

   

    <cinema id="2">

    <film>Inception</film>

    <director>Christopher Nolan</director>

    <year>2010</year>

    </cinema>

</root>

Using “@*|node()”  all elements and attributes and child nodes is copied to another document as given below:

Copy.xsl

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" encoding="utf-8" indent="no"/>                              

<xsl:template match="/">

       <xsl:copy-of select="@*|node()"/>

</xsl:template>                                   

</xsl:stylesheet>                             

Output of this XSLT transformation is

<?xml-stylesheet type="text/xsl" href="copy.xsl">

<root>

    <cinema id="1">

    <film>Predestination</film>

    <director>Spierig Brothers</director>

    <year>2014</year>

    </cinema>

   

    <cinema id="2">

    <film>Inception</film>

    <director>Christopher Nolan</director>

    <year>2010</year>

    </cinema>  

</root>