Starting with XML with the default namespace:
<Root> <A>foo</A> <B></B> <C>bar</C> </Root>
I use XSLT to remove the 'C' element:
<?xml version="1.0" ?> <xsl:stylesheet version="2.0" xmlns="http://www.w3.org/1999/XSL/Transform" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" indent="no" encoding="utf-8" /> <xsl:template match="*"> <xsl:copy> <xsl:copy-of select="@*" /> <xsl:apply-templates /> </xsl:copy> </xsl:template> <xsl:template match="C" /> </xsl:stylesheet>
and I get the following XML (itβs okay that βBβ is not dumped because I use HTML as an output method):
<Root> <A>foo</A> <B></B> </Root>
But if I ever get another XML, this time with a namespace:
<Root xmlns="http://company.com"> <A>foo</A> <B></B> <C>bar</C> </Root>
the C element is not deleted after the XSLT process.
What can I do to get around this namespace, is there a way?
source share