This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: How to efficiently remove "a" nodes with no "b" descend ants
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] How to efficiently remove "a" nodes with no "b" descend ants
- From: Teppo Peltonen <teppo dot peltonen at vtt dot fi>
- Date: 08 Mar 2001 18:45:45 +0200
- References: <95E3FBC144C1D411A1AB0090271F735D39C598@wiles2.sema.co.uk>
- Reply-To: xsl-list at lists dot mulberrytech dot com
"FINLEY, Mike" <Mike.FINLEY@sema.co.uk> writes:
Hello Mike,
> Why do you think your first offering is not "efficient"? I doubt
> you'll find anything more concise (one interpretation of efficient)
If I say
> <xsl:template match="a[not(.//b)]"/>
then all the descendants of "a" are checked for "b" elements. Let's
have a closer look at the input structure.
> <a>
<!-- match, all descendants of "a" are checked -->
> <b/>
> <c/>
> <a>
<!-- match, all descendants of "a" are checked, again -->
> <a>
<!-- match, all descendants of "a" are checked, again -->
> <a>
<!-- match, all descendants of "a" are checked, again -->
> <c>
> <b/>
> </c>
> </a>
> <a>
<!-- match, all descendants of "a" are checked, again -->
and so on...
Instead of this, I would like to go straight to the far-most child of
the first "a" element and flag the sub nodes that have "b"
descendants, moving upwards in the tree. (Sorry, my algorythms are a
bit rusty right now, but I think there is a name for this kind of tree
traversing...) This way I need to examine each node only once.
Or maybe I am misunderstanding how XLST implements this? (Anyway, it
doesn't seem very speedy to me ;-).
> mike
Thanks for your comments,
Teppo
--
Teppo Peltonen <mailto:teppo.peltonen@vtt.fi> phone 09 4566080
VTT Information Technology mobile 040 5651878
Tekniikantie 4 B, P.O.Box 1201, Espoo 02044 VTT telefax 09 4567052
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list