My XPath foo is not yet good enough to figure out how to do the following.
I have an XML that’s similar to:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<books>
<book>
<name>Fantastic World of Peggy</name>
<category>fiction</category>
<author-ref>/SanDiego/Peter</author-ref>
</book>
</books>
<cities>
<name>SanDiego</name>
<authors>
<author>
<name>Peter</name>
<awards-won>true</awards-won>
</author>
</authors>
</cities>
</root>
Now I want to access all the books where the author has won a prize.
I end up with the following XPath in my mind (which does not work):
//books[category = 'fiction' and //author[name = string-after(<the-current-book>/author-ref, '/SanDiego/') and awards-won = 'true']]
<the-current-book>
must be a reference to the book that is the current object in the outside condition.
I can hard-code the cities part as in my XMLs there is only one city but there are many books and many authors.
I have not yet found how to do this in XPath.
Any suggestions on how to do this?