Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: why is count(xpath) != xpath[last()] ? >Thread Next - Re: why is count(xpath) != xpath[last()] ? Re: why is count(xpath) != xpath[last()] ?To: NULL Date: 12/12/2007 11:40:00 AM > That's because Name elements aren't siblings. Each Name element is the > only Name element row element contains, so at the point when Name > element is selected, context node-set contains single Name element, so > last() = 1. > You need (/root/Students/row/Name)[position() = last()] Thank you, Oleg. What confuses me is that the use of the predicate filter seems to change the order of evaluation of the XPath expression. That is, select="/root/Students/row/Name" evaluates to a nodeset of two Names, and select="count(/root/Students/row/Name)" evaluates to the number 2. Given that, I had assumed that the XPath expression select="/root/Students/row/Name[position() = last()]" would be evaluated from left to right, yielding a nodeset, that would then be filtered by [position() = last()]. But this does not seem to be the case, if parentheses are required to change the order of evaluation. | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
