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

Re: : Re: complex XPATH test

Subject: Re: : Re: complex XPATH test
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Wed, 18 Jul 2001 17:12:03 +0100
xpath test presence
Hi Wendell,

> I also note your XPath to find the containing block is more
> efficient than mine (at least in that theoretically it is more
> amenable to optimization :-).

Actually I designed it like that because it's shorter to write and it
ties up with making it extensible. You could create a node set of the
names of block elements:

 <block>p</block>
 <block>li</block>
 <block>blockquote</block>
 ...

You can make this into a node set held by the $block-elements variable
(via a node-set() extension, a variable in processors that support XSLT
1.1, or through the old document('') trick) and then find an ancestor
whose local name was one of these block names:

  ancestor::*[local-name() = $block-elements][1]

But I think you're probably right about the efficiency with it as it
stands. Rule of thumb is that it's better to traverse any particular
axis once rather than traverse it multiple times and union the results
together. It doesn't matter so much with the ancestor axis 'cos it's
usually fairly short, but could make a big difference with
preceding/following.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 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.