[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How to efficiently remove "a" nodes with no "b" de

Subject: Re: How to efficiently remove "a" nodes with no "b" descend ants
From: Teppo Peltonen <teppo.peltonen@xxxxxx>
Date: 08 Mar 2001 18:45:45 +0200
Re:  How to efficiently remove "a" nodes with no "b" de
"FINLEY, Mike" <Mike.FINLEY@xxxxxxxxxx> 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@xxxxxx>     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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.