title: xquery for loop questions
body: <p>I have a xml containing books at a library. I want to list all the books that arent checked out. So m approach is to get all the books and if the book id matches a checked out book id do not list it, otherwise list it. </p>
  
  <p>In java or another language I would do a double for loop and loop over the elements is there something similar with xQuery?</p>
  
  <pre><code>&lt;book asin="0201100886" created="128135928" lastLookupTime="128135928"&gt; 
    &lt;uuid&gt;BA57A934-6CDC-11D9-830B-000393D3DE16&lt;/uuid&gt; 
    &lt;title&gt;Compilers&lt;/title&gt; 
    &lt;authors&gt; 
      &lt;author&gt;Alfred V. Aho&lt;/author&gt; 
      &lt;author&gt;Ravi Sethi&lt;/author&gt; 
      &lt;author&gt;Jeffrey D. Ullman&lt;/author&gt; 
    &lt;/authors&gt; 
    &lt;publisher&gt;Addison Wesley&lt;/publisher&gt; 
    &lt;published&gt;1986-01-01&lt;/published&gt; 
    &lt;price&gt;102.00&lt;/price&gt; 
    &lt;purchaseDate&gt;2005-01-22&lt;/purchaseDate&gt; 
  &lt;/book&gt; 
  
  &lt;borrowers&gt; 
    &lt;borrower id="1"&gt; 
      &lt;name&gt; John Doe &lt;/name&gt; 
      &lt;phone&gt; 555-1212 &lt;/phone&gt; 
      &lt;borrowed&gt; 
        &lt;book asin="0138613370"/&gt; 
        &lt;book asin="0122513363"/&gt; 
      &lt;/borrowed&gt; 
    &lt;/borrower&gt;
  &lt;/borrowers&gt;
  </code></pre>