RE: [xsl] Relative XPATH between 2 nodes

Subject: RE: [xsl] Relative XPATH between 2 nodes
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 28 Jan 2005 18:51:15 -0000
You might like to look at the algorithm Saxon uses for determining relative
document order between two nodes in a structure such as JDOM that doesn't do
this natively. It basically walks up from both nodes (stepping each
alternately) to find a common ancestor, then finds the relative sibling
position of the nodes that are children of this common ancestor.

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

> -----Original Message-----
> From: Lyublinski, Leonid 
> [mailto:Leonid.Lyublinski@xxxxxxxxxxxxxxxxxxxx] 
> Sent: 28 January 2005 16:40
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] Relative XPATH between 2 nodes
> 
> Right, I had to be more specific.
> 
> There is a defined XML document and XSLT to build.
> I need to built a template which takes 2 parameters - 2 
> single nodes or
> 2 xpath expression resulting in 1 and only 1 node each.
> This template supposed to create a XPATH expression, a short 
> cut between
> 2 given nodes.
> 
> >Do you want the shortest XPath expression, or the XPath expression
> whose evaluation touches fewest nodes?
> >   following-sibling::*[5]/child::*[2]
> >or
> >   following::*[29]
> 
> The first one it is.
> To my understanding the 1st (and longer) expression will be processed
> faster.
> I might be wrong though.
> 
> 
> --------------------------------------------------------------
> ----------------
> CONFIDENTIALITY  NOTICE:   This message is  intended only for 
> the use of
> the  individual or  entity to  which it is  addressed  and  
> may  contain
> information  that is privileged,  confidential or exempt from 
> disclosure
> by law.  If the reader of this message is not the intended 
> recipient, or
> the  employee  or agent responsible  for delivering  the 
> message  to the
> intended  recipient,  you  are  hereby  notified that  you 
> are  strictly
> prohibited  from   printing,  storing,  disseminating,  
> distributing  or
> copying  this message.   If you have  received  this message  
> in  error,
> please notify us immediately  by replying to the message and 
> deleting it
> from your computer.   Neither this information block,  the 
> typed name of
> the sender,  nor anything else in this message is intended to 
> constitute
> an electronic signature,  unless a specific statement to the 
> contrary is
> included in this message.  Thank you, Antares Management Solutions.
> ==============================================================
> ================

Current Thread