[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: default template (was:RE: text() and not())

Subject: Re: default template (was:RE: text() and not())
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 8 Jan 2002 15:57:08 GMT
star of david template
> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.