[Home] [By Thread] [By Date] [Recent Entries]

Subject: Re: finding "empty" text nodes where element has a specificattribute
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 12 Sep 2003 16:41:43 +0100
as always involving tests for empty, it depends what you mean bey empty


 //*[@name][(not(node()))]
tests for no element children at all (and a name attribute) so

<a name=""> </a> is non-empty, as is
<a name=""><!-- this --></a>
If you want want white space to count as empty then 
 //*[@name][not(normalize-space()))]

now the two above are selected (ie counted as empty) but
so is

<a name=""> <b/> </a>

If sub elements may be there you may want somnething like

 //*[@name][not(*)][not(normalize-space()))]

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member