xsl-list
[Top] [All Lists]

Re: finding "empty" text nodes where element has a specific attribute

2003-09-12 08:41:43

as always involving tests for empty, it depends what you mean bey empty


 //*[(_at_)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 
 //*[(_at_)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

 //*[(_at_)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



<Prev in Thread] Current Thread [Next in Thread>