I do not have an XPath manual in front of me at the moment but wonder if
this would work.

 

//abc[last()-1] | //abc[last()]

 

It would in some scripting languages and some compiled languages.

 

Also, a conditional could probably work using the "nilled( //abc[last()
-1] )" function in XPath.

 

George

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Harihara Vinayakaram
Sent: Friday, May 16, 2008 8:40 AM
To: [email protected]
Subject: [Webtest] Re: XPath implementation in WebTest

 

I am sorry but the xpath expression works the same way in Saxon as it
does in webtest .  
So maybe I am looking for an xpath expression that gets the only node
even if the expression is last() -1 

Regards
Hari



On Fri, May 16, 2008 at 8:49 PM, Harihara Vinayakaram <[EMAIL PROTECTED]>
wrote:

Hi
  I am not sure if this is the right place to ask this question . But
anyway 

My understanding is that the xpath exression //abc[last()-1] will return
the last but one element named abc .

It works most of the times except when there is only one element . 

In that case WebTest returns element not found while others like saxon
for example returns the last element .

Is this a bug ? or is my understanding wrong 

Regards
Hari

 

Reply via email to