Subject: Re: default template (was:RE: text() and not())
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 8 Jan 2002 15:57:08 GMT
|
> As I understand, <xsl:apply-templates/> will read through the
> source xml and look for templates in the stylesheet to process them
> with.
it won't look all through the XML file if that's what you mean,
xsl:apply-templates without a select attribute is equivalent to
<xsl:apply-templates select="node()"/>
so just selects the child elements, as the current node is th eroot,
there will just be one element selected (plus any comments or process
instructions at the top level)
> in which case, I
> have to include my own template to do nothing,
yes and no.
If you have an element <x> that has all sorts of children that yuu don't
want to process, it is more nomal to have a template for x which does
not call apply-templates and so naturally doesn't process its children
than it is to use a template for x that does use apply templates and
then make templates for each child that does nothing.
If only some of x's children need zapping, suppose you have
<x>
<a>a text</a>
<b>b text</b>
<c>c text</c>
</x>
and yoy want b to go, it is more natural to say
<xsl:template match="b"/>
ie have an empty template for b than to allow b to have the default
template which would process its text child, and then have
<xsl:template match="text()[parent::b]"/>
David
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- Re: text() and not(), (continued)
- David Carlisle - Tue, 8 Jan 2002 08:18:03 -0500 (EST)
- Andrew Welch - Tue, 8 Jan 2002 08:45:39 -0500 (EST)
- David Carlisle - Tue, 8 Jan 2002 09:09:48 -0500 (EST)
- Andrew Welch - Tue, 8 Jan 2002 09:39:49 -0500 (EST)
- David Carlisle - Tue, 8 Jan 2002 10:56:31 -0500 (EST) <=
- Wendell Piez - Tue, 8 Jan 2002 14:48:31 -0500 (EST)
- David Carlisle - Tue, 8 Jan 2002 08:23:53 -0500 (EST)
- Andrew Welch - Tue, 8 Jan 2002 08:50:31 -0500 (EST)
- David Carlisle - Tue, 8 Jan 2002 07:17:43 -0500 (EST)
|
|