title: How do I get BaseX to return multiple elements in a nested XQuery?
body: <p>BaseX is complaining about a nested query of mine. I do not understand why it cannot return multiple lines like it did in the first query. The error says, "Expecting }, found >" and the <code>&gt;</code> it is referring to is the <code>&gt;</code> after name under trips. It works fine if the <code>}</code> is after the close-bracket for id, but obviously, that's not what I want. Here is the query:</p>
  
  <pre><code>for $u in doc("export.xml")/database/USERS/tuple
     return 
     &lt;user&gt;
     &lt;login&gt;{$u/USERNAME/text()}&lt;/login&gt;
     &lt;email&gt;&lt;/email&gt;
     &lt;name&gt;&lt;/name&gt;
     &lt;affiliation&gt;&lt;/affiliation&gt;
     &lt;friend&gt;&lt;/friend&gt;
     &lt;trip&gt;
        {for $t in doc("export.xml")/database/TRIPS/tuple
        where $t/ADMIN/text() = $u/USERNAME/text()
        return 
        &lt;id&gt; {$t/ID/text()} &lt;/id&gt;
        &lt;name&gt; {$t/NAME/text()} &lt;/name&gt;       (: Error is here with &lt;name&gt; :)
        &lt;feature&gt; {$t/FEATURE/text()} &lt;/feature&gt;
        &lt;privacyFlag&gt; {$t/PRIVACY/text() &lt;/privacyFlag&gt;)
        }
     &lt;/trip&gt;
  &lt;/user&gt;
  </code></pre>