Subject: RE: Select the nearest of two preceding siblings
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 20 Jul 2007 10:20:50 +0100
|
> 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/
|