This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: preceding-sibling reversed ?


> 
> I'm still a bit perplexed. If you evaluate a nodeset in a 
> string context then only the first node in the nodeset is 
> considered. That's why
> 	following-sibling::div[@class = 'slide']/@id is the same as
> 	following-sibling::div[@class = 'slide'][1]/@id.
> On the other hand, 
> 	preceding-sibling::div[@class = 'slide']/@id is the same as
> 	preceding-sibling::div[@class = 'slide'][last()]/@id.
> 
> So it seems as if the reversed axis doesn't come into play - 
> of the entire nodeset, only the first is considered, but it's 
> the first in *document order*. Why?
> 
A positional predicate in a step of a path expression considers the
nodes in axis order: so for a reverse axis, [1] selects the last node in
document order.

XSLT always processes node-sets in document order, and the conversion of
a node-set to a string always uses the node that is first in document
order; the axis that was used to select the nodes is irrelevant.

Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]