xsl-list
[Top] [All Lists]

Re: Checking element to see if it has children...

2003-12-09 07:06:48
On 10/12/03 1:50 AM, "David Carlisle" <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:



I want the path to end with the element only if it doesn't contain other
elements, i.e. what railroad fans might call a "stub":

Since xml is normally called a tree rather than a network, that's a leaf
not a stub.

<xsl:for-each select="/*//*">

selects ever descendent of the first child, ie every element except teh
document element, you want every element with no child element that's
<xsl:for-each select="//*[not(*)">

(testing for no children (and generating path expressions) are both in
the faq for this list at www.dpawson.co.uk)

David


This worked like a charm--why is it every time I think you don't know what
I'm talking about (because I can be unclear at 3AM as if you haven't already
noticed) I find out you know exactly what I'm looking for?

Thanks again,

/johnny :)




-- 
INTIMACY = In-to-me-I-see 


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