Sameer Kumar Bhandula schrieb:
Hi Gurus,
My requirement is: To change tag name from <QuoteItem> to
<SimpleQuoteItem> when <ProductLevel> = 3.
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="QuoteItem[ ProductLevel = 3 ]">
<SimpleQuoteItem>
<xsl:apply-templates select="@*|node()"/>
</SimpleQuoteItem>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:transform>
XSLT I tried: [...] <xsl:copy-of select="."/> [...]
For what you want - make a minor change under certain conditions -
xsl:copy-of is not the way to go, as it makes a deep copy. You want
to keep everything as it is and make only a minor change. Whenever
this is the case, you need the so-called "identity template" (or "copy
template") plus templates defining your modifications.
http://www.dpawson.co.uk/xsl/sect2/identity.html
Michael Ludwig