on 02-06-2015 6:38 AM
As per requirement ,I have done some changes to response mapping which is coming from 3rd party (SOAP) by using XSLT mapping.Now i need to add URL to root node of the Response mapping by using XSLT mapping .
for above requirement : i have tried below code but it's not success
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- This XLST extracts the authorities' web service response into the expected proxy structure. -->
<!-- <xsl:variable name="test" select="local-name(//*[local-name()='Body']/*[1])"/> -->
<xsl:template match="*">
<ns0:InResponse xmlns:ns0="http://sankar.com/xi/isankar/SD">
<xsl:element name="{local-name()}">
<!-- <xsl:copy copy-namespaces="no"> -->
<xsl:apply-templates select="@*|node()" />
<!-- </xsl:copy> -->
</xsl:element>
</ns0:InResponse>
</xsl:template>
</xsl:stylesheet>
Could you pls share related links or give me some approaches to resolve the issue?
Thanks,
Sankar
Hi Sankar,
Please use below XSLT mapping to add the namespace to the root node.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:vbs="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*" />
</xsl:copy>
</xsl:template>
<xsl:template match="/*">
<xsl:element name="ns:{local-name()}" namespace="http://sankar.com/xi/isankar/SD">
<xsl:apply-templates select="node()|@*" />
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Regards,
Praveen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bhavani,
If you want to add a namespace to root node, you can find some links about this:
XSLT : Add a namespace declaration to the root element - Stack Overflow
XSLT: Add namespace to root element - Stack Overflow
The trikc is simple, you map directly your root element with all the desired namespaces and the rest you can use a xsl:copy-of-select
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.