Reputation: 2028
I've the following XML, I used Xquerry to query some results using Qexo. How to query only the attributes like affiliation? Like if i want to query all affiliations of each author?
I could do the simpler ones, but this is very tricky and din't get any online reference......
<conference>
<paper>
<conferencename>VLDB</conferencename>
<year>2006</year>
<author affiliation="ASU"> K. Selçuk Candan</author>
<author affiliation="NEC America"> Wang-Pin Hsiung</author>
<author affiliation="Turn"> Songting Chen</author>
<author affiliation="NEC America"> Jun'ichi Tatemura</author>
<author affiliation="UCSB">Divyakant Agarwal</author>
<Article>AFilter: Adaptable XML Filtering with Prefix-Caching and Suffix-Clustering. 559-570
Electronic Edition (link) BibTeX </Article>
<place>Seoul, Korea</place>
</paper>
</conference>
Just to return all values , this is the Xquery used.
for $x in doc("vldb.xml")/conference/paper
where $x/conferencename = "VLDB"
order by $x/Author
return
<x>
{ $x/Author, $x/Article, $x/conferencename, $x/year}
</x>
Upvotes: 1
Views: 120
Reputation: 243599
You forgot to specify what is the wanted output ... ?
Try something like this:
for $x in /conference/paper
where $x/conferencename = "VLDB"
order by $x/Author
return
<x affiliation = "{$x/author/@affiliation}">
{$x/author, $x/Article, $x/conferencename, $x/year}
</x>
Upvotes: 1