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

Re: AW: Matching two consecutive <br><br>

Subject: Re: AW: Matching two consecutive <br><br>
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 23 Aug 2004 11:29:27 +0100
matching following sibling node
> Could you be so kind and translate the predicates into plain english
> to help my understanding - I'm especially keen on knowing to which
> node "self" maps and in which order the predicates are mapped to the
> node sets? 

self:: is an axis that just contains the current node
so self::br matches the current node if it's a br and matches nothing
otherwise. so when used as a predicate it's the same as
name(.)='br'
except it's probably a bit more efficient and more importantly it's
"namespace safe", if you are using namespaces you can never be 100%
certain what string name() is going to return as a processor may think
up arbitrary prefixes on the fly so you may be expecting
name(.)='br' but actually teh processor returns a name(0 of _xx_654:br
(this can't happen for the no-namespace case as such elements can never
have a prefix)

predicates are always applied left-to-right
so
br[following-sibling::node()[1][self::br]]
matches all br's for which
following-sibling::node()[1][self::br]
is true
as that is a node set "true" here means non-empty
following-sibling::node()
selscts all following siblings (so this is empty if we are not the
youngest child)
[1]
selcts the first such node (if there is one) so again this is non empty
if we are not the youngest child.
[self::br]
selcts the one remaining node that got pas the [1] if that is a br.
so

following-sibling::node()[1][self::br]

is a node set of size 1 consisting of a br element if the node following
the current br is a br, and it's an empty node set otherwise.

David




________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.