That stylesheet that you have shown in your last post simply copies elements through to the result tree, it does not change namespaces of elements. Thus if you get e.g. <SDLT xmlns=""> in the result then that is only a copy of what is in the input
So either you already have those xmlns="" in the input or your stylesheet has more templates than you have shown. Generally you have to understand that namespace declarations or undeclarations like xmns="someURI" or xmlns="" are in scope for the element they appear on at any descendants, unless there is a new definition on the descendants. That means if you have e.g.
<element1 xmlns="">
<element2/>
<element3/>
</element1>
then all three elements, element1, element2, element3 are in no namespace.
The same way, if you have e.g
<element1 xmlns="http://example.com/2007/ns1">
<element2/>
<element3/>
</element1>
then all three elements are in the namespace http://example.com/2007/ns1.
If a stylesheet has a literal result element in a certain namespace e.g.
<element1 xmlns="http://example.com/2007/ns1">
but then inside of that elements copies elements from the input tree which are in no namespace then when the result is serialized you get e.g.
<element2 xmlns="">
as the full element includings its namespace is copied and the serializer has to add the undeclaration to preserve the element that has been copied from the input.
It is not quite clear how your input and your complete stylesheet looks but what you complain about seems to have the reasons described above. To fix that your stylesheet cannot simply copy elements, it has to correct the namespace too where needed e.g.
<IRenvelope xmlns="http://www.validatio.co.uk/">
<xsl:apply-templates mode="vnamespace"/>
</IRenvelope>
<xsl:template match="* mode="vnamespace">
<xsl:element name="{local-name()}" namespace="http://www.validatio.co.uk/">
<xsl:apply-templates mode="vnamespace"/>
</xsl:template>
|