我需要使用XSLT取消注释XML并删除xml版本标记的帮助:
原始XML:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TSC>
<customApiError>
<!--<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error>
<httpStatusCode>400</httpStatusCode>
<httpMessage>Bad Request</httpMessage>
</error>-->
</customApiError>
</TSC>
转换后的XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TSC>
<customApiError>
<error>
<httpStatusCode>400</httpStatusCode>
<httpMessage>Bad Request</httpMessage>
</error>
</customApiError>
</TSC>
答案 0 :(得分:2)
如果您的处理器支持disable-output-escaping
,那么您可以这样做
<xsl:template match="comment()">
<xsl:value-of select="substring-after(., '?>')" disable-output-escaping="yes"/>
</xsl:template>
适用于所有disable-output-escaping
的所有常规警告。