RE: Empty elements

Subject: RE: Empty elements
From: "Pawson, David" <DPawson@xxxxxxxxxxx>
Date: Thu, 21 Sep 2000 14:48:18 +0100
Nick Browne

> Dave, I added another node to your test : 
<node id="id04"><x> </x></node>
> i.e. a non-empty descendent of a node without text children.
> Results were : Instant Saxon 5.3.2 -->  Node: id04 is not empty using
> string(.)
> Node: id04 has
> children

> This then brings us round to the meaning of stripping of pure 
> white space
> text nodes - so its back to the spec(s) and FAQs then !

gut reaction (I can see DC cringing :-) would be that id04 is
not empty (it has children). The fact that the child element
is 'empty' (my defn) is for later.
 My simplistic view is that we are talking about *this* element,
not its children, grandchildren etc.

I tried 
<node id="id05"> <x> </x></node>
<node id="id06"> <x></x></node>

Both of these show up as not empty using string().
 Again this feels about right.
for all the purposes I have needed to date :-)
 I'd like a test for 'empty' (my definition), to exclude
 any element which has children. I.e. I'm likely to 
be testing for such as empty table cells, paragraphs,
basically elements which have either mixed or pcdata content.
 I'd most likely want to recognise and treat differently
nodes which have child elements.

I'm happy with Saxon's definition.

Regards DaveP

 XSL-List info and archive:

Current Thread