Skip to Content

SOAP envelope, header and body addition using XSLT Mapping in SAP PI

Sep 12, 2017 at 05:07 AM


avatar image
Former Member

Dear All,

I have a requirement to add the SOAP Envelope, Header and Body segments to match the desired format required by the target party. I have used XSLT to achieve this. My input is:


<declarantTin>200000328-1</declarantTin> /* this declarantTin is a field inside Billing Request */


I am able to run in the Operation Mapping using the attached XSLT code. xsltcode.txt

Now, I am getting the output as attached - output-xslt.txt. But I need to replace the namespace prefix "ns0" with "tem" at all places in the output (also need to remove xmlns:ns0=" after NillingRequest) . Can you please let me know what can be done to modify the XSLT code to achieve this and get the expected final output as attached expected-final-output.txt?

10 |10000 characters needed characters left characters exceeded
Former Member

Please assist.

* Please Login or Register to Answer, Follow or Comment.

1 Answer

Evgeniy Kolmakov Sep 12, 2017 at 08:10 AM

Hi Amita!

Here is generic template to change namespace prefix:

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl=""

<!--template to copy elements-->
<xsl:template match="*">
<xsl:element name="tem:{local-name()}">
<xsl:apply-templates select="@* | node()"/>

<!--template to copy attributes--> 
<xsl:template match="@*">
        <xsl:attribute name="{local-name()}">
            <xsl:value-of select="."/>

<!--template to copy the rest of the nodes  -->
<xsl:template match="comment() | text() | processing-instruction()">


Regards, Evgeniy.

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Many thanks Evgeniy for the response. Let me try with this code, just wanted to know what is this local-name () exactly, do I need to replace local-name () with my root node field name?


Hi Amita!

"local-name()" function is used to get the name part of element, without namespace prefix and namespace definition.

Regards, Evgeniy.