Subject: Re: Testing if a nodeset is empty
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 1 Oct 2001 09:41:39 +0100
|
> I would like to avoid an empty <chapter> tag
If you use a node set in a boolean context (eg xsl:if test attriubute)
then it counts as true if it is non empty and false if it is empty
so if you'd been testing against a node set from the source document
you would only need to go
<xsl:if test="p[@stylename='heading 1,Part']">
but you want to test against a result tree fragment generated by
applying templates.
rtf can only be compared as strings so:
<xsl:variable name="a"><xsl:apply-templates select="p[@stylename='heading
1,Part']" /></xsl:variable>
<xsl:if test="$a != ''">
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
|