我有一个来自客户的以下肥皂信封
<soap:Envelope xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<wsa:Action>http://company.com/services/InterfacePoint/CallResponse</wsa:Action>
<wsa:MessageID>uuid:85fafb9d-9ec0-4017-a367-4f9043812310</wsa:MessageID>
<wsa:To>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:To>
<wsse:Security>
<wsu:Timestamp wsu:Id="Timestamp-dc059677-19f6-4b2c-a69b-ec0dffc6b1db">
<wsu:Created>2013-03-28T16:24:33Z</wsu:Created>
<wsu:Expires>2013-03-28T16:29:33Z</wsu:Expires>
</wsu:Timestamp>
</wsse:Security>
</soap:Header>
<soap:Body>
<TXLife xsi:schemaLocation="http://ACORD.org/Standards/Life/2 TXLife2.22.00.XSD" xmlns="http://ACORD.org/Standards/Life/2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
.
.
.
</TXLife>
</soap:Body>
</soap:Envelope>
我只是对检索里面的内容感兴趣soap:Body
并丢弃其他所有内容。我写这个XSLT
来提取那个
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="soap:Envelope/soap:Body">
<xsl:copy-of select="@*|node()" />
</xsl:template>
</xsl:stylesheet>
XSLT
当肥皂信封中没有标题时,这可以正常工作,但是如果我将其应用于上面XML
,它也会输出标题元素的值,因此它产生的输出是:
http://company.com/services/InterfacePoint/CallResponseuuid:85fafb9d-9ec0-4017-a367-4f9043812310http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous2013-03-28T16:24:33Z2013-03-28T16:29:33Z<TXLife xmlns="http://ACORD.org/Standards/Life/2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xsi:schemaLocation="http://ACORD.org/Standards/Life/2 TXLife2.22.00.XSD">
.
.
.
</TXLife>
但我希望输出为:
<TXLife xmlns="http://ACORD.org/Standards/Life/2">
.
.
.
</TXLife>
我不在乎是否存在其他名称空间。