[
Lists Home |
Date Index |
Thread Index
]
>I want to make a XPath expression that finds the 5 first nodes that have a
>attribute "namn" thats equals "Tomas". Is it possible?
>
>I suppose it should be something like this:
>//[@namn="Tomas"] [position()<6]
Something like that!
You forgot the * after //, but you also have the problem that
position() will return the position of the node amongst its matching
siblings, not amongst all the matching nodes. You need to parenthesize
the first part of the expression to get the effect you want:
(//*[@namn="Tomas"])[position()<6]
-- Richard
|