Empty template matches will omit those from the output:
<!--Identity template-->
<xsl:template match="@*|*">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<--empty templates override the identity transform for specified
matches-->
<xsl:template match="Evens | Squares"/>
HTH,
Ryan
-----Original Message-----
From: Fraser Goffin [mailto:goffinf(_at_)googlemail(_dot_)com]
Sent: Friday, October 10, 2008 10:44 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Excluding a complete branch while identity copying
I want to be able to copy a complete XML instance as/is except for [say]
some specific parts of the input tree. I thought immediately of using an
identity transform and specifying copy, but how to remove those pesky
sub-trees :-
Say this was my input :-
<Numbers>
<Odds>
<One>1</One>
<Three>3</Three>
<Five>5</Five>
</Odds>
<Evens>
<Two>2</Two>
<Four>4</Four>
<Six>6</Six>
</Evens>
<Doubles>
<Two>4</Two>
<Four>8</Four>
<Eight>16</Eight>
</Doubles>
<Squares>
<Two>4</Two>
<Four>16</Four>
<Eight>64</Eight>
</Squares>
</Numbers>
and I want to copy everything to output except <Evens> and <Squares>.
Lets also assume that the order of the input is undefined, so Evens and
Squares may/may not be in the positions I have shown above, although I
can assume that they are both children of <Numbers>.
Further, I don't know what all the children of Evens and Squares are
called I just know I don't want them.
Whats the easiest way of accomplishing this ?
many thanks
Fraser.
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
This message is private and confidential. If you have received it in error,
please notify the sender and remove it from your system.
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--