|
Subject: Re: [xsl] moving namespace to soap envelope declaration and changing the namespace prefix inbody From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 22 Oct 2012 21:23:08 -0400 |
I have soap request which looks like the following
Input: ...
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: ...
I tried to do it like the following ... <xsl:stylesheet version="1.0"
<!-- special handling for soap:Header -->
<xsl:template match="*[local-name()='Header' and namespace-uri()='http://schemas.xmlsoap.org/soap/envelope/']">
... xmlns:sally="http://schemas.xmlsoap.org/soap/envelope/" ... <xsl:template match="sally:Header">
<xsl:variable name="suHeader" select="value of subHeader"/> <xsl:copy>
the output of this xsl is coming as Input, how can i change it the output
<!--preserve the document element and add arbitrary namespace prefixes-->
<xsl:template match="/*">
<xsl:element name="{name(.)}" namespace="{namespace-uri(.)}">
<xsl:copy-of select="document('')/*/namespace::*[name(.)!='xsl']"/>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template><!--reconstitute elements with a hardwired prefix on output-->
<xsl:template match="v11:*">
<xsl:element name="v11:{local-name(.)}" namespace="{namespace-uri(.)}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template><!--reconstitute elements with a hardwired prefix on output-->
<xsl:template match="v1:*">
<xsl:element name="v1:{local-name(.)}" namespace="{namespace-uri(.)}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template><!--every other element can be reconstituted ignoring attached namespaces-->
<xsl:template match="*">
<xsl:element name="{name(.)}" namespace="{namespace-uri(.)}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template></xsl:stylesheet> T:\ftemp>
-- Contact us for world-wide XML consulting and instructor-led training Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] moving namespace to soap enve, ram | Thread | [xsl] Diffing XML, Emma Burrows |
| [xsl] moving namespace to soap enve, ram | Date | RE: [xsl] deduplicating information, Robby Pelssers |
| Month |