Skip to Content
0
Apr 22, 2015 at 07:42 AM

XSLT mapping to remove namespace prefix

1040 Views

Hi experts,

I have one requrement where I need to remove the prefix ns0 from the xml (given below) getting generated in message mapping.

<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns0:ExecuteRequest xmlns:ns0="http://test/">

<ns0:_sRequestXML><inteflow>body</inteflow></ns0:_sRequestXML></ns0:ExecuteRequest></soap:Body></soap:Envelope>

I am usimg the below xslt and it is now adding one ns0 prefix in the tag <inteflow>.

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

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">

<ExecuteRequest xmlns="http://test/">

<_sRequestXML>

<inteflow>

<xsl:copy-of select="//inteflow"/>

</inteflow>

</_sRequestXML>

</ExecuteRequest>

</xsl:template>

</xsl:stylesheet>

Result after using xslt.

<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ExecuteRequest xmlns="http://test/"><_sRequestXML>

<inteflow xmlns:ns0="http://decisionintellect.com/inteport/"></inteflow></_sRequestXML></ExecuteRequest></soap:Body></soap:Envelope>

Can you please help. What is wrong in the xslt and how I can get the desired result.

Thanks & Regards,

Pratyus Ganguly

<?