Subject: Re: Understanding Identity Transformations
From: Karl Stubsjoen <kstubs@xxxxxxxxx>
Date: Mon, 14 Feb 2005 14:00:06 -0700
|
Given the following XML:
<DATA>
<FOO cat="BLUE"></FOO>
<FOO cat="BLUE"></FOO>
<FOO cat="RED">
<FOO cat="PINK"></FOO>
<FOO cat="GREEN"></FOO>
<FOO cat="BLUE"></FOO>
</FOO>
<FOO cat="BLUE"></FOO>
<FOO cat="YELLOW"></FOO>
<FOO>on you!</FOO>
</DATA>
This:
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
<xsl:template match="*[@cat][not(@cat='BLUE')]"/>
Produces:
<DATA>
<FOO cat="BLUE" />
<FOO cat="BLUE" />
<FOO cat="BLUE" />
<FOO>on you!</FOO>
</DATA>
I don't want the <FOO>on you!</FOO> match.
However, I don't understand how the root element was picked up, I
figured it would be ignored resulting in no results.
|