I really need help in copying the root node.

I have been spending far too much time on this, and I can't beleive that it should be that difficult. I can't use 'copy-of', as that will copy all the children as well. I need to copy the root node, and it's attributes. This is what I currently have:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pre="http://schemas.namespace.org/myschema/myschame.xsd">
   <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

   <xsl:template match="/">
      <xsl:element name="{name()}">
         <xsl:apply-templates select="pre:Msg" />
      </xsl:element>
   </xsl:template>

   <xsl:template match="pre:Msg">

         
      <xsl:for-each select="pre:Record">

            <xsl:sort select="pre:ReplaceRecord/pre:Id/pre:Number" />
            <xsl:sort select="pre:EventSequenceNumber" data-type="number"/>
         <xsl:copy-of select="." />
      </xsl:for-each>


   </xsl:template>

</xsl:stylesheet>

The above xsl will thow an error. It has something to do with namespaces. The error is:

An attribute whose value must be a QName had the value ''

I have tried using the namespace attribute, plus a heap of other things. All I wish to do is to copy the root node. Can somebody please help me with this. Thankyou.

I beleive I have it now. I needed the following:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pre="http://schemas.namespace.org/myschema/myschame.xsd">
   <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

   <xsl:template match="/">
         <xsl:apply-templates select="pre:Msg" />
   </xsl:template>

   <xsl:template match="pre:Msg">
      <xsl:copy>

         
         <xsl:for-each select="pre:Record">

            <xsl:sort select="pre:ReplaceRecord/pre:Id/pre:Number" />
            <xsl:sort select="pre:EventSequenceNumber" data-type="number"/>
            <xsl:copy-of select="."/>
         </xsl:for-each>

      </xsl:copy>

   </xsl:template>

</xsl:stylesheet>

A case of still learning XSL.

This question has already been answered. Start a new discussion instead.