|
Subject: [xsl] moving namespace to soap envelope declaration and changing the namespace prefix inbody From: ram <ram_kurra@xxxxxxxxxxx> Date: Tue, 23 Oct 2012 00:51:26 +0800 (SGT) |
Hi,
I have soap request which looks like the following
Input:
<soapenv:Envelope xmlns:v1="http://abcd.com/v1"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<v1:SubHeader xmlns:v1="http://abcd.com/test/eia/v1">
</v1:SubHeader>
</soapenv:Header>
<soapenv:Body>
<v1:CreateResponse>
</v1:CreateResponse>
</soapenv:Body>
</soapenv:Envelope>
I need to move the namespace of
SubHeader to soap envelope declaration and change the namespace prefix of all
the child nodes of of soap body to v11.
Output:
<soapenv:Envelope
xmlns:v11="http://abcd.com/v1"
xmlns:v1="http://abcd.com/test/eia/v1" xmlns:soapenv="http://schemas.xmlsoap
.org/soap/envelope/">
<soapenv:Header>
<v1:SubHeader >
</v1:SubHeader>
</soapenv:Header>
<soapenv:Body>
<v11:CreateResponse>
<v11:a1> </v11:a1>
</v11:CreateResponse>
</soapenv:Body>
</soapenv:Envelope>
I tried to do
it like the following
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<!-- identity transform
-->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates
select="@*|node()" />
</xsl:copy>
</xsl:template>
<!-- special handling for
soap:Header -->
<xsl:template match="*[local-name()='Header' and
namespace-uri()='http://schemas.xmlsoap.org/soap/envelope/']">
<xsl:variable name="suHeader" select="value of subHeader"/>
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
<xsl:copy-of
select='$subHeader' />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
the output of this xsl is coming as Input, how can i change it the output
Thanks
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Re: dynamic xpath from va, M Balaji | Thread | Re: [xsl] moving namespace to soap , G. Ken Holman |
| Re: [xsl] Re: dynamic xpath from va, M Balaji | Date | Re: [xsl] moving namespace to soap , G. Ken Holman |
| Month |