4
的XML从XML使用默认名字空间开始:绕过命名空间;而拷贝使用XSLT
<Root>
<A>foo</A>
<B></B>
<C>bar</C>
</Root>
我申请一个XSLT删除“C”元素:
<?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>
我结束了用下面的XML(这是确定有“B”,因为我使用的HTML作为输出方法没有崩溃):
<Root>
<A>foo</A>
<B></B>
</Root>
不过,如果我的e版本得到另一个XML,这次命名空间:
<Root xmlns="http://company.com">
<A>foo</A>
<B></B>
<C>bar</C>
</Root>
的“C”元素XSLT处理后不会被删除。
我能做些什么绕过这个命名空间,有没有办法?
什么是用于声明 “http://www.w3.org/1999/XSL/Transform” 命名空间的原因在中两次?恕我直言,应该删除默认的命名空间声明。 –
Tomalak
2009-06-11 13:30:02
其实没有理由,我的不好。 – 2009-06-12 09:43:20