This conversion is :
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:x="my:x">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="x:*">
<xsl:element name="{local-name()}">
<xsl:copy-of select="namespace::*[not(. = namespace-uri(..))]"/>
<xsl:apply-templates select="node()|@*"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
removes any element from the namespace "my:x"and puts it in "no namespace".
For example, when applied to the following XML document:
<t>
<x:a xmlns:x="my:x"/>
</t>
required, the correct result is obtained :
<t>
<a/>
</t>
To remove only a specific item from a specific namespace, a template that overrides an identification rule must be more specific to match only the desired item .
source
share