I'm using XSLT to tranform an order create xml into an order response xml. My stylesheet needs to do two things:
1. Replace all occurrences of "OrderCreate" with "OrderResponse". The code below replaces a single tag called <OrderCreate>. How do I make it replace tags like <OrderCreateBody> into <OrderResponseBody>, <OrderCreateDetails> into <OrderResponseDetails>? I would like to use a wild-card character to do that instead of coding <xsl:template match="xxx"> for each of them.
2. I need to insert an additional ResponseStatus element
right before a certain node. How can I do this?
Thanks a lot!!!
1. Replace all occurrences of "OrderCreate" with "OrderResponse". The code below replaces a single tag called <OrderCreate>. How do I make it replace tags like <OrderCreateBody> into <OrderResponseBody>, <OrderCreateDetails> into <OrderResponseDetails>? I would like to use a wild-card character to do that instead of coding <xsl:template match="xxx"> for each of them.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform">[/URL]
<xsl:output version="1.0" encoding="UTF-8" indent="yes" method="xml" omit-xml-declaration="no"/>
<xsl:template match="/">
<xsl:apply-templates select="*"/>
</xsl:template>
<xsl:template match="node()">
<xsl:copy>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="OrderCreate">
<OrderResponse>
<xsl:apply-templates select="node()"/>
</OrderResponse>
</xsl:template>
</xsl:stylesheet>
2. I need to insert an additional ResponseStatus element
Code:
<ResponseStatus>
<ResponseCode>
</ResponseCode>
<ResponseMessage>
</ResponseMessage>
</ResponseStatus>
Thanks a lot!!!