Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: why is count(xpath) != xpath[last()] ?

From: jfrensen@-------.---
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.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent