This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Ignoring Child Nodes using XPath
- To: "Ciaran Byrne" <ciaran dot byrne at 3tl dot com>
- Subject: Re: [xsl] Ignoring Child Nodes using XPath
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Mon, 26 Mar 2001 09:54:09 +0100
- CC: "Xsl-List" <xsl-list at lists dot mulberrytech dot com>
- Organization: Jeni Tennison Consulting Ltd
- References: <NEBBIEMMKMAEPLDEIMPEOEFJCGAA.ciaran.byrne@3tl.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi Ciaran,
> Is there a way in which I can select a node ignoring the child nodes
> as in the following example:
Selecting a node just points to the node, tells the processor that it
should be dealt with. The processor only does what you tell it to do,
so if you want the child nodes to be ignored, you just have to *not*
tell it to do anything with them.
So for example, you could use the following template to copy the p
element and its attributes but ignore its children:
<xsl:template match="p">
<xsl:copy>
<xsl:copy-of select="@*" />
</xsl:copy>
</xsl:template>
Note no templates are applied to or copies made of the child nodes of
the p element. You don't tell the processor to do anything with them,
so it does nothing, effectively ignoring them.
I hope that helps,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list