xsl-list
[Top] [All Lists]

[xsl] moving namespace to soap envelope declaration and changing the namespace prefix inbody

2012-10-22 11:51:46
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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


<Prev in Thread] Current Thread [Next in Thread>