Reputation: 1
I'm trying to return all authors of a set of records by running the following xquery :
for $a in /Record
return data($a/AuthorList/Author/Surname)
I've got this:
your query returned an empty sequence
I'm sure about the xpath but I don't know what is wrong with it.
Upvotes: 0
Views: 765
Reputation: 8422
When you get no results, it often means your query was specific in ways that don't match your data. What I do is back off to something more general, then gradually get more specific.
Start with this:
for $a in /Record
return $a
Get anything? If not, you don't actually have any /Record items. Maybe you need a namespace? If you did get something, try:
for $a in /Record
return $a/AuthorList
Usually somewhere in this process, I find that I'd missed a namespace, or had the hierarchy wrong. That's as specific as I can be without seeing some of your data.
Upvotes: 3