[xquery-talk] Subqueries in XQuery?

Wei, Alice Ju-Hsuan ajwei at indiana.edu
Wed Dec 26 20:00:42 PST 2007


Hi,

  I am a newbie to XQuery, and I am trying to figure out how to put subqueries into my output.
  This is my XQuery:
declare boundary-space preserve;

<ul>

{
for $file in doc("resume_2.xml"),
     $author in distinct-values($file//author[./@type='Faculty' or ./@type='co-author'])
              order by $author ascending
     return  <li>{data($author)}</li>
}
</ul>

  Currently, there are five items that were extracted from the document, and they are in order, but I also want the specific content inside each {data($author)} to be in alphabetical order.

  Eg:

 <ul>
   <li>O,M,P,</li>
   <li>P,R,Q</li>
   </ul>

   Desired Output:

  <ul>
    <li>M, O,P</li>
    <li>P,Q,R</li>
   </ul>

Is this possible?

Thanks to those who can help.

Alice Wei
MIS 2008
School of Library and Information Science
Indiana University Bloomington
ajwei at indiana.edu
812-856-2659



More information about the talk mailing list