This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Testing if a nodeset is empty



>  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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]