XPath query to return nodes based on a range within an attribute's value.
-
Hello All, I want to return a set of nodes where the value of my ID attribute falls within a specified range. i.e. if I have 200 elements with each elements' ID being sequential I would like to return N of them where the @ID >= X and @ID <= Y. But regardless of how I try to do this I end up with nothing! For example :
/element[@ID >= '44' and following-sibling[@ID <= '50']
Ideally this would return 6 elements but I get nothing, nor does :
/input[@ID >= '44' and following-sibling[@ID <= '50']]
I would appreciate your help on this please, it's driving me to distraction.
-- Moo
-
Hello All, I want to return a set of nodes where the value of my ID attribute falls within a specified range. i.e. if I have 200 elements with each elements' ID being sequential I would like to return N of them where the @ID >= X and @ID <= Y. But regardless of how I try to do this I end up with nothing! For example :
/element[@ID >= '44' and following-sibling[@ID <= '50']
Ideally this would return 6 elements but I get nothing, nor does :
/input[@ID >= '44' and following-sibling[@ID <= '50']]
I would appreciate your help on this please, it's driving me to distraction.
-- Moo
you're over-thinking it:
element[@ID >= '44' and @ID <= '50']
-
you're over-thinking it:
element[@ID >= '44' and @ID <= '50']