Predicates and Operators in Xpath
General
XML
XPath
- explains predicators
- explains simple operators
Description :
| PREDICATE | Description |
|---|---|
| book[1] | Frist node in book |
| book[last()] | Last node in book |
| [last()-1] | Last but one |
| [position<3] | First two nodes |
| //title[@lang] | Any "title" nodes with a "lang" attribute |
| /bookstore/book[price>35.00] | Alt books in bookstore which are expensive than 35 unit |
| OPERATOR | Description |
| //book/title || //book/price | Double pipe used as AND |
| //book | //cd | merges two nodes |
| (+), (-), (div), (*), (=) | Arithmetic operators |
Example :
2025 Jan