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 に答える