In my schema I have element which has IDREF attribute.I want to extract id value to which points and check whether that value is equivalent to some value.
eg:
<AUTHOR EMAILID ="psmith@sfsu.edu">
<FNAME>smith</FNAME>
<MI>j</MI>
<LNAME>jen</LNAME>
</AUTHOR>
<PAPER PAPERID = 10 EMAILID = "sai@yahoo.com">
<MAINATHR>SHARMA</MAINATHR>
<TITLE>ABC</TITLE>
</PAPER>
<PAPER PAPERID = 10 EMAILID = "sha@yahoo.com">
<MAINATHR>SHARMA</MAINATHR>
<TITLE>ABC</TITLE>
</PAPER>
let $id := "sai@yahoo.com",
for $paper in $doc/PAPER[@EMAILID = $id],
for $author in $doc/AUTHOR[@EMAILID = $id]
return
<result PAPERID="{$paper/@PAPERID}">
{$author/FNAME}
<result>
for $paper in $doc/PAPER,
for $author in $doc/AUTHOR
where $paper/@EMAILID = $auther/$EMAILID
return
<result PAPERID="{$paper/@PAPERID}">
{$author/FNAME}
<result>
如上例程序,在xquery中引用节点和节点属性名称的时候稍有不同。
节点 paper 属性 @paper
I am completely new to XQuery..
I have the following which I would like to run on an .xml file...
for $book in bib.xml//book
let $title := $book/title
where $book/publisher = 'Addison-Wesley'
return
<bookInfo>
{ $title }
</bookInfo>
and the bib.xml file
<bib>