title: Getting error in XSLT 1.0 for adding multiple namespaces
body: <p>I have a requirement to add namespaces in XML using XSLT 1.0. I am getting the below error in the XSLT -
  ERROR:  'Unsupported XSL element 'http://www.w3.org/1999/XSL/Transform:namespace''</p>
  <p>Input XML -</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;ns0:NAXML-POSJournal version="" xmlns:ns0="http://www.naxml.org/POSBO/Vocabulary/2003-10-16"&gt;
    &lt;ns0:TransmissionHeader&gt;
      &lt;ns0:StoreLocationID/&gt;
      &lt;ns0:VendorName/&gt;
      &lt;ns0:VendorModelVersion/&gt;
      &lt;ns1:TransmissionHeaderExtension xmlns:ns1="http://www.radiantsystems.com/NAXML-Extension" /&gt;
    &lt;/ns0:TransmissionHeader&gt;
    &lt;ns0:JournalReport&gt;
      &lt;ns0:JournalHeader&gt;
        &lt;ns0:ReportSequenceNumber/&gt;
        &lt;ns0:PrimaryReportPeriod/&gt;
        &lt;ns0:SecondaryReportPeriod/&gt;
        &lt;ns0:BeginDate/&gt;
        &lt;ns0:BeginTime/&gt;
        &lt;ns0:EndDate/&gt;
        &lt;ns0:EndTime/&gt;
      &lt;/ns0:JournalHeader&gt;
    &lt;/ns0:JournalReport&gt;
  &lt;/ns0:NAXML-POSJournal&gt;</code></pre>
  </div>
  </div>
  </p>
  <pre><code>XSLT -
  </code></pre>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns1="http://www.radiantsystems.com/NAXML-Extension" xmlns:ns0="http://www.naxml.org/POSBO/Vocabulary/2003-10-16" exclude-result-prefixes="ns0 ns1" version="3.4"&gt;
    &lt;xsl:output encoding='UTF-8' indent='yes' method='xml' /&gt;
  
    &lt;xsl:template match="*" priority="1" version="3.4"&gt;
  
      &lt;xsl:element name="{local-name()}" namespace="http://www.naxml.org/POSBO/Vocabulary/2003-10-16"&gt;
        &lt;xsl:namespace name="xsi" select="'http://www.w3.org/2001/XMLSchema-instance'" /&gt;
        &lt;xsl:namespace name="xmime" select="'http://www.w3.org/2005/05/xmlmime'" /&gt;
        &lt;xsl:namespace name="radiant" select="'http://www.radiantsystems.com/NAXML-Extension'" /&gt;
        &lt;xsl:namespace name="schemaLocation" select="'http://www.naxml.org/POSBO/Vocabulary/2003-10-16 NAXML-PBI34RadiantExtended.xsd'" /&gt;
        &lt;xsl:apply-templates select="@*|node()" /&gt;
      &lt;/xsl:element&gt;
    &lt;/xsl:template&gt;
  &lt;/xsl:transform&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>Output (Required) -</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;NAXML-POSJournal xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:schemaLocation="http://www.w3.org/2005/05/test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:radiant="http://www.radiantsystems.com/NAXML-Extension" xmlns="http://www.naxml.org/POSBO/Vocabulary/2003-10-16"
    version=""&gt;
    &lt;TransmissionHeader&gt;
      &lt;StoreLocationID/&gt;
      &lt;VendorName/&gt;
      &lt;VendorModelVersion/&gt;
      &lt;TransmissionHeaderExtension/&gt;
    &lt;/TransmissionHeader&gt;
    &lt;JournalReport&gt;
      &lt;JournalHeader&gt;
        &lt;ReportSequenceNumber/&gt;
        &lt;PrimaryReportPeriod/&gt;
        &lt;SecondaryReportPeriod/&gt;
        &lt;BeginDate/&gt;
        &lt;BeginTime/&gt;
        &lt;EndDate/&gt;
        &lt;EndTime/&gt;
      &lt;/JournalHeader&gt;
    &lt;/JournalReport&gt;
  &lt;/NAXML-POSJournal&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I have tried with one more XSLT mapping which is removing all the namespaces however it should by logic should add the namespaces.</p>
  <p>XSLT -</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
      &lt;xsl:output method="xml" indent="yes" encoding="UTF-8"/&gt;
      &lt;xsl:template match="/"&gt;
          &lt;xsl:copy&gt;
              &lt;xsl:apply-templates/&gt;
          &lt;/xsl:copy&gt;
      &lt;/xsl:template&gt;
      &lt;xsl:template match="@*"&gt;
          &lt;xsl:attribute name="{local-name()}"&gt;
              &lt;xsl:value-of select="current()"/&gt;
          &lt;/xsl:attribute&gt;
      &lt;/xsl:template&gt;
      &lt;xsl:template match="*"&gt;
          &lt;xsl:element name="{local-name()}"&gt;
              &lt;xsl:apply-templates select="@* | * | text()"/&gt;
          &lt;/xsl:element&gt;
      &lt;/xsl:template&gt;
      &lt;xsl:template match="text()"&gt;
          &lt;xsl:copy&gt;
              &lt;xsl:value-of select="current()"/&gt;
          &lt;/xsl:copy&gt;
      &lt;/xsl:template&gt;
      &lt;xsl:template match="/NAXML-POSJournal"&gt;
          &lt;NAXML-POSJournal xmlns="http://www.naxml.org/POSBO/Vocabulary/2003-10-16"
  xmlns:radiant="http://www.radiantsystems.com/NAXML-Extension"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
  xmlns:schemaLocation="http://www.w3.org/2005/05/test"&gt;
              &lt;xsl:apply-templates select="@*|node()"/&gt;           
          &lt;/NAXML-POSJournal&gt;
      &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet</code></pre>
  </div>
  </div>
  </p>