on 08-14-2008 9:42 PM
Hi,
Is there some easy xslt code to change the following: (I want the ns0 tag and namespace introduced in the root node so that my mapping works. I have created the mapping using externally provided wsdl, but the input message expects the prefix ns0 whereas the message coming to me from third party does not have the prefix. So in order to force it through the mapping I am thinking of using xslt to translate <createOrUpdateJobsResponse> to <ns0:createOrUpdateJobsResponse xmlns:ns0="http://service.webservice.xxxxxxxx.com"> and the closing tag </createOrUpdateJobsResponse> to </ns0:createOrUpdateJobsResponse>.
Source:
<?xml version="1.0" encoding="UTF-8"?>
<createOrUpdateJobsResponse>
<createOrUpdateJobsReturn>
<errorCode/>
<errorMessage/>
<goodResult/>
<jobReferenceNumber/>
</createOrUpdateJobsReturn>
</createOrUpdateJobsResponse>
Target:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:createOrUpdateJobsResponse xmlns:ns0="http://service.webservice.xxxxxxxx.com">
<createOrUpdateJobsReturn>
<errorCode/>
<errorMessage/>
<goodResult/>
<jobReferenceNumber/>
</createOrUpdateJobsReturn>
</ns0:createOrUpdateJobsResponse>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi James,
You could give a try with this :
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://service.webservice.xxxxxxxx.com" version="1.0">
<xsl:output indent="yes" omit-xml-declaration="no"/>
<xsl:template match="/">
<ns0:createOrUpdateJobsResponse>
<xsl:apply-templates/>
</ns0:createOrUpdateJobsResponse>
</xsl:template>
<xsl:template match="createOrUpdateJobsReturn">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
It should recreate the same msg structure with a ns0 namespace for the output document
Rgds
Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.