Skip to Content

XSLT To Remove Soap Envelope...

Hi,

I'm trying to use XSLT mapping to remove SOAP envelope from a soap response message. Facing some issues.

This is my response message(with soap envelope):

<?xml version="1.0" encoding="UTF-8"?>

http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/">

<soapenv:Body>

enterprise.soap.sforce.com">

<result>

false https://blitzna1.eng.salesforce.com/services/Soap/c/5.0> aaaaaaaaaaaaaaa

<userId>bbbbbbbbbb</userId>

</result>

</loginResponse>

</soapenv:Body>

</soapenv:Envelope>

-


This is my xsl program:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

http://www.w3.org/1999/XSL/Transform" xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/">

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="soapenv:Body">

<xsl:copy-of select="soapenv:Body"/>

</xsl:template>

</xsl:stylesheet>

-


Where am I going wrong here?

Regards,

Harsh

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Aug 25, 2006 at 04:02 PM

    This is wrong:

    <xsl:template match="soapenv:Body">

    <xsl:copy-of select="soapenv:Body"/>

    When you have template match="node", you can only work with sub nodes. So your XSLT searches for sub nodes of <i>Body</i> with the name <i>Body</i>.

    You could use select=".", but you want to remove the SOAP envelope, so you have to remove the tag Body as well:

    <xsl:template match="soapenv:Body">

    <xsl:copy-of select="child::node()"/>

    Regards

    Stefan

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Harsh,

      standard is the Altovas XMLSpy, you can use a freeware home version. You can test as well with IE (yes, Microsofts Internet Explorer). Just put

      <?xml-stylesheet type="text/xsl"  href="C:myFoldermyStyle.xsl"?>

      to the top (behind the declaration) of your XML document.

      Regards,

      Udo