cancel
Showing results for 
Search instead for 
Did you mean: 

xsl copy-of statement is not working when there is a attribute in source xml

Former Member
0 Kudos

Hi,

I am getting the response with soap.envelope and trying to remove this one, if there is attribute my xsl:copy of statement is not working. Please help.

while trying to use the copy-of select following attribute it's giving me error - <id xsi:nil="true"/>

I wanted to use only xslt mapping not any other mappings...

xslt code:

<?xml version='1.0' ?>

<xsl:stylesheet version="1.0"  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

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

  <xsl:template match="SOAP-ENV:Body">

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

    </xsl:template>

</xsl:stylesheet>

source xml : 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <soapenv:Body>

      <updateResponse>

         <result>

            <errors>

               <fields>Id</fields>

               <message>Account ID: id value of incorrect type: 001d0VelZ</message>

               <statusCode>MALFORMED_ID</statusCode>

            </errors>

            <id xsi:nil="true"/>

            <success>false</success>

         </result>

      </updateResponse>

   </soapenv:Body>

</soapenv:Envelope>

Regards,

Venu.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Venu,

Please try this:

<?xml version='1.0' ?>

<xsl:stylesheet version="1.0"  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

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

  <xsl:template match="SOAP-ENV:Body">

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

    </xsl:template>

</xsl:stylesheet>

Copy-of copies all child elements and attributes so there is no need of child::.

Also will you please share your both source and target xmls?

Regards,

Beena

Former Member
0 Kudos

Below attribute is not copying...

<id xsi:nil="true"/>

my source xml :

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:enterprise.soap.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <soapenv:Body>

      <updateResponse>

         <result>

            <errors>

               <fields>Id</fields>

               <message>Account ID: id value of incorrect type: 0010VelZ</message>

               <statusCode>MALFORMED_ID</statusCode>

            </errors>

            <id xsi:nil="true"/>

            <success>false</success>

         </result>

      </updateResponse>

   </soapenv:Body>

</soapenv:Envelope>

and target xml, I wanted to get from <updateResponse> </updateResponse>

Former Member
0 Kudos

Hello,

I tried with same xslt you provided earlier and I am getting this attribute. Please see below screenshot:

Former Member
0 Kudos

I tried in xslt tool (cooktop) it's giving me error - let me check in the message mapping.

Former Member
0 Kudos

It's working in operation mapping level, but when I tried it did not work in xslt tool and I thought this will not work in operation mapping also..but it worked in mapping after import the respective xslt mapping. Thanks for your help.

Answers (0)