Change the Tag positions in SOAP XML using XSLT
I need to take the tag from one position to other.
The request is as follows
<Envelope>
<Header>
<Assertion></Assertion>
<Security></Security>
</Header>
</Envelope>
But I need an XSLT to put the assertion tag inside security as follows:
<Envelope>
<Header>
<Security>
开发者_StackOverflow社区 <Assertion></Assertion>
</Security>
</Header>
</Envelope>
I appreciate Your Help. Thanks
The following stylesheet:
<xsl:stylesheet version="1.0" xmlns:xsl="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="Assertion" />
<xsl:template match="Security">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
<xsl:copy-of select="../Assertion"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
...produces the desired output when applied to your provided source:
<Envelope>
<Header>
<Security>
<Assertion></Assertion>
</Security>
</Header>
</Envelope>
精彩评论