Is there are more concise way than using position() for multiple conditions in XPath? -
in xpath can use *[position()=1 or position()=last()] both first , last matching node. however, if want either first or last node can use *[1] or *[last()] respectively. trying use *[1 or last()] selects nodes. there more concise way of joining conditions?
short answer: no. there no more concise way [position()=1 or position()=last()] make sense purpose.
regarding predicate tried [1 or last()] :
- number
0translated booleanfalse, rest translatedtrue. last()returns position index of last element in context
given above rules, kind of predicate expressions [1 or last()] translated [true or true] evaluates true, that's why all nodes using predicate.
Comments
Post a Comment