[xsl] is there really a need for location steps of ".."?

Subject: [xsl] is there really a need for location steps of ".."?
From: "Robert P. J. Day" <rpjday@xxxxxxxxxxxxxx>
Date: Wed, 12 Mar 2003 09:25:52 -0500 (EST)
  a number of examples in the xpath books and tutorials i'm reading
seem to enjoy showing examples involving ".." as one of the location
steps, or some operation involving "backing up".  as one example, 
simpson's book "XPath and XPointer":

  //part[. = "Hands"]/ancestor::*

sure, i can see that this represents the node-set of all ancestors
of all part elements whose string value is "Hands".

  but it seems that this expression is equivalent:

  //*[descendant::part = "Hands"]	# appears to mean the same

one obvious difference, admittedly, is that the first expression
will generate a node-set in order going up, while the second will
work its way down from the root.

  other than that, are these equivalent?  more to the point, 
it seems that most location paths can be rewritten to get rid
of this kind of "backing up" idea.  and is efficiency an issue
here?  or does it not matter all that much?

  just curious how others see this.

rday


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread