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

Re: xpath - getting precedeing-sibling::element/@id ?

Subject: Re: xpath - getting precedeing-sibling::element/@id ?
From: Oliver Becker <obecker@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 11 Jul 2001 10:55:40 +0200 (MET DST)
xpath getting ancestor
Hi,

> also, there is no gaurantee that the preceding element
> is a sibling of the current node.
> 
> I'm thinking more along the lines of getting the
> preceding::tab element (cousin (diff parent) or
> sibling) where the current element has tab/@state='on'
> 
> for example:
> 
> <tab state="off">
>   <tab id="1.2.1"></tab>
>   <tab id="1.2.2"></tab>
>   <tab id="1.2.3"></tab>
> </tab>
> <tab state="on">
>   <tab id="1.3.1" state="on"></tab>
> </tab>
> <tab state="off">
>   <tab id="1.4.1"></tab>
> </tab>
> 
> 
> if i'm on tab where id="1.3.1" & state="on", i want to
> grab the preceding nested <tab> (id='1.2.3')...
> 
> the end result I'm after is basically so that with the
> deepest <tab> that has state="on", i can grab the
> preceding/following deepest <tab>...in this case
> yielding preceding <tab id="1.2.3"> and following <tab
> id="1.4.1">

If I understand you right, then you mean by preceding also the
ancestors and by following also the descendants.

Do
   (preceding::tab | ancestor::tab)[@id][last()]/@id
and
   (following::tab | descendant::tab)[@id][1]/@id
fulfill your requirements?

Did you manage to find the deepest tab[@state='on']?

Cheers,
Oliver


/-------------------------------------------------------------------\
|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: obecker@xxxxxxxxxxxxxxxxxxxxxxx             |
|  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/


 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.