...
Note that the predicate always refers to the whole node it is written after, so there is a difference between //book/price[@currency] and //book[price/@currency]. The first one selects only prices with a currency attribute, stored inside of a book and the second one selects whole books with price prices with a currency attribute.
...