小编Ala*_*KER的帖子

如何从输出xml中删除命名空间?

下面是我的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-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>
Run Code Online (Sandbox Code Playgroud)

在输出中我得到如下

<?xml version="1.0" encoding="UTF-16"?>
<XMLResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Product>-----</Product>
</XMLResponse>
Run Code Online (Sandbox Code Playgroud)

我需要xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"从xml输出中删除

xml xslt xpath namespaces xml-namespaces

15
推荐指数
1
解决办法
3万
查看次数

标签 统计

namespaces ×1

xml ×1

xml-namespaces ×1

xpath ×1

xslt ×1