register
other register

Tuesday, May 06, 2008

Remove unwanted namespace in XSLT

If we have the xslt like below:


<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:abc="http://www.abc.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<content>
...
</content>

</xsl:stylesheet>


The result xml will be look like:


<conent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.polopoly.com/polopoly/cm/xmlio"
xmlns:abc="http://www.abc.com">
...
</conent>


The namespaces in the tag are not what we want. We can remove these namespaces by using

exclude-result-prefixes="xsl abc xsi" in the xsl:stylesheet declaration.

No comments: