2012-01-23 12 views
1

私は以下のXMLを使いました.Qexoを使っていくつかの結果を照会するためにXqueryを使いました。所属などの属性のみを照会する方法私は各著者のすべての提携を照会したいのですか?QexoのXML属性クエリ。

私はシンプルなものを行うことができますが、これは非常にトリッキーであり、任意のオンラインの参照を取得din't ......

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

答えて

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> 

こののようなものを試してみてください