1

我有以下 XML,我使用 Xquery 使用 Qexo 查询一些结果。如何仅查询从属关系等属性?就像我想查询每个作者的所有附属机构一样?

我可以做更简单的,但这很棘手,没有任何在线参考......

    <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>

只是为了返回所有值,这是使用的 Xquery。

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>
4

1 回答 1

1

您忘记指定想要的输出是什么...?

尝试这样的事情

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> 
于 2012-01-24T14:28:50.250 回答