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

RE: Select the nearest of two preceding siblings

Subject: RE: Select the nearest of two preceding siblings
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 20 Jul 2007 10:20:50 +0100
RE:  Select the nearest of two preceding siblings
> Sorry if this is too simple, but I'm still a bit new at this. 
> I need to compare the relative positions of two preceding 
> siblings and grab the value of the nearest one.

I haven't managed to follow the detail of your requirement, but given two
nodes $A and $B you can select the one that comes last in document order
using

($A|$B)[last()]

or if you prefer

if ($A>>$B) then $A else $B

Michael Kay
http://www.saxonica.com/

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-2011 All Rights Reserved.