Location paths are quite indiscriminate. For example, the path 'book/chapter/para' selects all of the paragraphs in all of the chapters. But there is often a need to target a more selective set of elements, and possibly a single element instance.
A predicate filter is used to qualify any step in the path. The list of matches at each step is reduced by asking questions about the nodes in this list. Square brackets, '[' and ']', are used to hold the predicate:
The predicate filter holds one or more test expressions. The results of the test (or tests) is a single boolean value, and the selection only succeeds when the value is true.
The ' position()' function returns the sequential location of the element ...