(: Find the very first author listed in the document. Over bibliography.xml. parke godfrey 2013-11-05 What if we wanted to find just the very first author mentioned in the doc? There are many ways. Below is one. What is happening in that query? The "(...)" around doc... marks a node-list. Sure enough, the XPath generator here returns a node-list. The "[1]" is then with respect to that node-list (array), and it returns the first node (first element of the array). Note FOR expects a node-list after the IN to iterate over. The "[1]" returned a node, not a node-list! Well, XQuery casts a node to a node-list when needed (e.g., "a" to "(a)"). As well, it casts a node-list to a single "value", as needed. More on that later. :) { for $first at $i in (doc("bibliography.xml")//author)[1] return {$i}. {data($first)} }