Xml 对值进行迭代的xquery

Xml 对值进行迭代的xquery,xml,xquery,Xml,Xquery,以下是我的xml: <book asin="0201100886" created="128135928" lastLookupTime="128135928"> <uuid>BA57A934-6CDC-11D9-830B-000393D3DE16</uuid> <title>Compilers</title> <authors> <author>Alfred V. Aho</autho

以下是我的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> 

BA57A934-6CDC-11D9-830B-000393DE16
编译程序
阿尔弗雷德·V·阿霍
拉维·塞蒂
杰弗里·D·厄尔曼
我想知道Jeffrey D.Ullman合著的所有书籍。这意味着他不可能是名单上的第一作者。到目前为止,我的xQuery是:

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>
xquery版本“1.0”;
对于$book in doc(“library.xml”)/library/items/book
如果没有($book/authors/author=“Jeffrey D.Ullman”)
返回
{数据($book/作者/作者)}

这就给了我所有他没有写过的书,但除了做作者[2]作者[3]之外,我如何检查其他作者,看看他是否是合著者?

如果他是第三作者呢?还有什么不硬编码的吗?@zach:
fn:subsequence($seq,$start)
表示从
$start
位置开始的子序列。这与
/library/items/book[authors/author[position()!=1]=“Jeffrey D.Ullman”]
/library/items/book[authors/subsequence(author, 2) = "Jeffrey D. Ullman"]