When you are talking about XSLT you don't tend to think in this way, i.e. you don't usually describe your requirements as 'inserting'.
I'm assuming you have some basic input XML, which matches what you have here. Any kind of copy like this usually starts with the Identity Transform:
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
Then you process the ones that have exceptions, something like this:
<xsl:template match="Sample">
<xsl:copy>
<xsl:apply-templates select="Ball|Bat"/>
<Game/>
<xsl:apply-templates select="Glove|Field"/>
</xsl:copy>
</xsl:template>
Whether this is what you actually mean or not I'm not 100% sure.
/- Sam Judson : Wrox Technical Editor -/
|