能否请您告诉我如何从XML标记中仅删除名称空间xmlns="http://ws.apache.org/ns/synapse"
?
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sap-com:document:sap:rfc:functions">
<soapenv:Body>
<urn:BAPI_QM_DEFECT_RECORDING>
<AMOUNT xmlns="http://ws.apache.org/ns/synapse">1</AMOUNT>
<DEFECT_CODE xmlns="http://ws.apache.org/ns/synapse">393</DEFECT_CODE>
<DEFECT_DESC xmlns="http://ws.apache.org/ns/synapse">393</DEFECT_DESC>
<DEFECT_PID xmlns="http://ws.apache.org/ns/synapse">601000</DEFECT_PID>
<INSPID xmlns="http://ws.apache.org/ns/synapse"/>
<ORDER xmlns="http://ws.apache.org/ns/synapse">20262950</ORDER>
<ORIGIN_PID xmlns="http://ws.apache.org/ns/synapse">600000</ORIGIN_PID>
<OVER_CONSUMP xmlns="http://ws.apache.org/ns/synapse">text</OVER_CONSUMP>
</urn:BAPI_QM_DEFECT_RECORDING></soapenv:Body></soapenv:Envelope>
答案 0 :(得分:0)
您可以通过创建元素use local-name来使用以下代码,该元素将使用不带名称空间的名称:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:sap-com:document:sap:rfc:functions">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="urn:BAPI_QM_DEFECT_RECORDING/*">
<xsl:element name="{local-name(.)}">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>