This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Testing if a nodeset is empty
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] Testing if a nodeset is empty
- From: David Carlisle <davidc at nag dot co dot uk>
- Date: Mon, 1 Oct 2001 09:41:39 +0100
- References: <001601c14a4e$090bfe50$f804caa8@gilw019>
- Reply-To: xsl-list at lists dot mulberrytech dot com
> 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