如何从输出xml中删除名称空间?
下面是我的xsl如何从输出xml中删除名称空间?,xml,xslt,xpath,namespaces,xml-namespaces,Xml,Xslt,Xpath,Namespaces,Xml Namespaces,下面是我的xsl <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ms="http://www.test.com/schemas/test" xmlns:ns="urn:schemas-microsoft-com:xslt" exclude-result-p
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ms="http://www.test.com/schemas/test"
xmlns:ns="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="ms ns">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<XMLResponse>
<xsl:apply-templates select="ms:ProductRS/ms:Product"/>
</XMLResponse>
</xsl:template>
<-- some templates here -->
</xsl:stylesheet>
在输出中,我得到如下结果
<?xml version="1.0" encoding="UTF-16"?>
<XMLResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Product>-----</Product>
</XMLResponse>
-----
我需要删除
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance“
从xml输出中要排除名称空间,则应以以下方式表示:-
排除结果前缀=“ms ns xsi
”
基本上,您的样式表如下所示:-
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ms="http://www.test.com/schemas/test"
xmlns:ns="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="ms ns xsi">
您在什么环境中工作,并且是该XMLResponse行中对xsi命名空间的唯一引用?为什么需要删除该命名空间?为什么要这样做?或者,如果xsi前缀没有在样式表中的任何地方使用,也不想在输出中使用,那么只需删除声明。但是在“复制”上它不起作用(在每个副本上需要提供副本命名空间=“否”),但我尝试找到最好的方法。。。