Why is this XSLT to extract soap:Body also have soap:Header element values

Opal

New Member
I have a following soap envelope coming from client\[code\]<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>\[/code\]I'm just interested in retrieving what is inside \[code\]soap:Body\[/code\] and discard everything else. I wrote this \[code\]XSLT\[/code\] to extract that\[code\]<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>\[/code\]This \[code\]XSLT\[/code\] works fine when there is no header in soap envelope but if I apply this to above \[code\]XML\[/code\], it outputs values of header elements also, so the output it produces is:\[code\]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>\[/code\]but I want output to be:\[code\]<TXLife xmlns="http://ACORD.org/Standards/Life/2">...</TXLife>\[/code\]I don't care if other namespaces exist or not.
 
Back
Top