RE: [xsl] Copy a node inside a template but exclude a deeply nested child

Subject: RE: [xsl] Copy a node inside a template but exclude a deeply nested child
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 4 Sep 2006 12:52:32 +0100
> I have an existing xslt and in one of the templates it makes 
> a copy of a node from the xml document, I now have the need 
> to exclude a deeply nested child from that copy

You have to replace the xsl:copy-of with a recursive use of the identity
template:

<xsl:template match="*" mode="copy">
  <xsl:copy>
  <xsl:copy-of select="@*"/>
  <xsl:apply-templates mode="copy"/>
  <xsl:copy>
</xsl:template>

<xsl:template match="element-to-be-excluded" mode="copy"/>

Michael Kay
http://www.saxonica.com/

Current Thread