on 09-12-2017 6:07 AM
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:
<BillingRequest>
<declarantTin>200000328-1</declarantTin> /* this declarantTin is a field inside Billing Request */
</BillingRequest>
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="http://tempuri.org/ 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?
Hi Amita!
Here is generic template to change namespace prefix:
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns0="http://your.source.namespace"
xmlns:tem="http://your.target.namespace"
exclude-result-prefixes="ns0">
<!--template to copy elements-->
<xsl:template match="*">
<xsl:element name="tem:{local-name()}">
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:template>
<!--template to copy attributes-->
<xsl:template match="@*">
<xsl:attribute name="{local-name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>
<!--template to copy the rest of the nodes -->
<xsl:template match="comment() | text() | processing-instruction()">
<xsl:copy/>
</xsl:template>
</xsl:stylesheet>
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.