Re: [xsl] Replacing default namespace

Subject: Re: [xsl] Replacing default namespace
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Sun, 01 Jul 2007 23:54:57 +0200
Martin Honnen wrote:

To avoid that use a template like this


  <xsl:template match="*">
    <xsl:element name="{name()}" namespace="{namespace-uri()}">
      <xsl:apply-templates select="@* | node()"/>
    </xsl:element>
  </xsl:template>

for element nodes that you want to copy without its namespaces nodes.

Your code mimics the xsl:copy behavior. I assume you meant:


<xsl:element name="{name()}" namespace="http://othernamespace";>

Or:

<xsl:element name="{name()}" namespace="">

which will remove the namespace entirely (and will effectively remove the prefix, placing the element in the default null namespace).

-- Abel

Current Thread