【发布时间】:2019-10-17 04:31:30
【问题描述】:
如何从这家书店退回第三本书?
declare context item := document{
<bookstore>
<book category="cooking">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="children">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="web">
<title lang="en">XQuery Kick Start</title>
<author>James McGovern</author>
<author>Per Bothner</author>
<author>Kurt Cagle</author>
<author>James Linn</author>
<author>Vaidyanathan Nagarajan</author>
<year>2003</year>
<price>49.99</price>
</book>
<book category="web" cover="paperback">
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
</bookstore>
};
let $date := current-date()
for $ctx in context
return $ctx/bookstore/book[3]
到目前为止,我只得到一个空白结果:
PS C:\Users\thufir\Desktop\basex> PS C:\Users\thufir\Desktop\basex> basex contextDoc.xq PS C:\Users\thufir\Desktop\basex>
【问题讨论】:
标签: xml xpath xml-parsing xquery basex