Xml 为什么xslt不能删除<;sMessage>;节点
这是我的过滤器:Xml 为什么xslt不能删除<;sMessage>;节点,xml,xslt,Xml,Xslt,这是我的过滤器: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" > <xsl:template match="Table1/*"> <xsl:copy
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" >
<xsl:template match="Table1/*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="Table1">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="xs:schema">
</xsl:template >
<xsl:template match="sMessage">
</xsl:template >
</xsl:stylesheet>
这是我的XML:
<GetWorkOrderListResponse xmlns="http://buildfolio.com/TamesWebSvs/">
<GetWorkOrderListResult>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<NewDataSet xmlns="">
<Table1 diffgr:id="Table11" msdata:rowOrder="0" diffgr:hasChanges="inserted">
<WR_ID>862</WR_ID>
<WR_NO>RP-WO302</WR_NO>
</Table1>
<Table1 diffgr:id="Table12" msdata:rowOrder="1" diffgr:hasChanges="inserted">
<WR_ID>722</WR_ID>
<WR_NO>TT12012-WO263</WR_NO>
</Table1>
</NewDataSet>
</diffgr:diffgram>
</GetWorkOrderListResult>
<sMessage>Download Success!</sMessage>
</GetWorkOrderListResponse>
862
RP-WO302
722
TT12012-WO263
下载成功!
我无法从输出中删除sMessage节点。我的输出包含文本下载成功!,我正试图摆脱它。我错过了什么?
谢谢。您缺少的是您的XML文档有一个默认名称空间:
xmlns="http://buildfolio.com/TamesWebSvs/"
<xsl:template match="tws:sMessage" xmlns:tws="http://buildfolio.com/TamesWebSvs/">
根据作用域继承,sMessage元素位于该命名空间中。要匹配它,您需要告诉匹配者在该命名空间中查找sMessage:
xmlns="http://buildfolio.com/TamesWebSvs/"
<xsl:template match="tws:sMessage" xmlns:tws="http://buildfolio.com/TamesWebSvs/">