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

RE: preceding sibling headaches

Subject: RE: preceding sibling headaches
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 23 Apr 2003 08:49:09 +0100
test local name ..
> I thought that once you used a predicate ([1]), you couldn't go 
> any further in detail.

A lot of people imagine that. I've no idea why. Applying predicates to
intermediate steps in a path expression is one of the most powerful
techniques in XPath.


test="preceding-sibling::*[1]/self::transition" works as follows:

1. Select all the preceding sibling elements
2. Select the first of these
3. Select this node if it is a transition element, or nothing if not
4. Convert the result to a boolean: true if the node-set selected in (3)
is non-empty

I usually write this one as

test="preceding-sibling::*[1][self::transition]"

but the result is the same.

Avoid tests like name()='transition' if you can. They are likely to be
more expensive, and are less resilient to your choice of namespace
prefixes in the source document. The only time to use them is when
testing against a variable, e.g. name()=$param, and ideally you should
then test local-name() and namespace-uri() rather than testing name().

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 



 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.