C
cyclops
I'm trying to do XML + XSLT -> Another XML. The source XML contains
multiple namespaces and XSLT will handle all possible tags under each
name space.
----source----
<document xmlns="..." xmlns:a="..." xmlns:b="">
....
----XSLT----
....
<xsl:template match="a:sometag">
....
</xsl:template>
<xsl:template match="b:sometag" />
<xsl:template match="defaultNsInSource:sometag" />
....
The problem I met is the generated xml document always contains
namespace declarations for all name spaces in source xml.
I've tried to add exclude-result-prefixes="yes" or
exclude-result-prefixes="a" in XSLT <xsl:stylesheet> tag, the later one
successfully prevent namespace "a" decalaration from generating, while
the others are still there. Even though there aren't tags under these
name spaces in result xml.
So how to prevent all namespace decalarations from generating into the
result xml?
Thanks
multiple namespaces and XSLT will handle all possible tags under each
name space.
----source----
<document xmlns="..." xmlns:a="..." xmlns:b="">
....
----XSLT----
....
<xsl:template match="a:sometag">
....
</xsl:template>
<xsl:template match="b:sometag" />
<xsl:template match="defaultNsInSource:sometag" />
....
The problem I met is the generated xml document always contains
namespace declarations for all name spaces in source xml.
I've tried to add exclude-result-prefixes="yes" or
exclude-result-prefixes="a" in XSLT <xsl:stylesheet> tag, the later one
successfully prevent namespace "a" decalaration from generating, while
the others are still there. Even though there aren't tags under these
name spaces in result xml.
So how to prevent all namespace decalarations from generating into the
result xml?
Thanks