Reputation: 55
Here is my xml:
<book asin="0201100886" created="128135928" lastLookupTime="128135928">
<uuid>BA57A934-6CDC-11D9-830B-000393D3DE16</uuid>
<title>Compilers</title>
<authors>
<author>Alfred V. Aho</author>
<author>Ravi Sethi</author>
<author>Jeffrey D. Ullman</author>
</authors>
</book>
I want to know all the books who were co-authored by Jeffrey D. Ullman. That means he cant be the first author in the list. So my xQuery so far is:
xquery version "1.0";
for $book in doc("library.xml")/library/items/book
where not($book/authors/author = "Jeffrey D. Ullman")
return
<name>{data($book/authors/author)}</name>
That gives me all the books he hasnt authored but how do I go over the rest of the authors besides doing author[2] author[3] to see if he co authored it?
Upvotes: 0
Views: 481
Reputation: 163595
/library/items/book[authors/subsequence(author, 2) = "Jeffrey D. Ullman"]
Upvotes: 1