karl368 / firepath

Automatically exported from code.google.com/p/firepath
GNU General Public License v3.0
0 stars 0 forks source link

position doesnt work #27

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Go to a page that has two selects on it
2. Try to select one of them:
//select[position()=1]
3. Unfortunately both of them are returned, not just the first (position is 
just ignored)

Firepath 0.9.6.1 with Firefox 4.0.1

Original issue reported on code.google.com by rocorn...@gmail.com on 31 May 2011 at 1:53

GoogleCodeExporter commented 9 years ago
Thanks for reporting this issue.
However if you look at xPath specification this is the expected behavior and it 
affects all elements.
If you look here: http://www.w3.org/TR/xpath/#path-abbrev there is the 
following note:
"NOTE: The location path //para[1] does not mean the same as the location path 
/descendant::para[1]. The latter selects the first descendant para element; the 
former selects all descendant para elements that are the first para children of 
their parents."

Now if you go to this test page: http://fiddle.jshell.net/xDEuH/3/show/
and run //select[position()=1] and /descendant::select[position()=1] you will 
see the difference.

Original comment by pierre.t...@gmail.com on 5 Jun 2011 at 1:30