Example 1

Look for: The first name of the author with an id of 1.
XPath Expression: key('book-author', '1')/first-name
Result: Kim

Example 2

Look for: The title of the first book found with an author's first name of Eva.
XPath Expression: //book[key('book-author', @author-id)/first-name = 'Eva']/title
Result: Midnight Rain

Example 3

Look for: The title of the first book written by an author with an id of 2.
XPath Expression: key('author-book', '2')/title
Result: Midnight Rain

Example 4

Look for: The first name of the author of the book Midnight Rain.
XPath Expression: //author[key('author-book', id)/title = 'Midnight Rain']/first-name
Result: Eva

Example 5

Display a list of books, grouped by author

Kim Ralls
Wrote: Maeve Ascendant

Eva Corets
Wrote: Midnight Rain
Wrote: Oberon's Legacy