Re: [xsl] Exclude elements from apply-templates?

Subject: Re: [xsl] Exclude elements from apply-templates?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 21 Jun 2002 20:50:51 +0100


> ><xsl:apply-templates select="*[not(self::title) or not(name()=subtitle)]"/>

> For some reason <title> (not <subtitle>) turns up a second time, if I write
> this exactly

You were supposed to write what Joerg meant not what he wrote.
name()=subtitle 
tests teh name f the current element against the string value of its
child subtitle element. 
name()='subtitle'
was intended which tests the name of teh current element against the
string 'subtitle'.
it's better to use the self::subtitle form though ratherthan using
name() as it's shorter, likely to be a bit quicker (if not noticeable)
and more importantly it works correctly with namespaces, which name()
does not.

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