xsl-list
[Top] [All Lists]

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

2006-09-04 08:18:07

Thanks Michael,

For completeness, I accomplished your code below by copying your two
templates into my xslt stylesheet and replacing -

<xsl:copy-of select="content/main/show/node()"/>

with -

<xsl:apply-templates mode="copy" select="content/main/show/node()"/>



It seems to work very well, hopefully that is as you described I should
do?


Cheers Adam.


-----Original Message-----
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com]
Sent: Mon 9/4/2006 12:52 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Copy a node inside a template but exclude a deeply
nested child
 
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/


--~------------------------------------------------------------------
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>
--~--


--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>