(: XQuery comments are marked by mirrored smilie faces, like this. :)
An empty query is not valid. There needs to be something besides the comment
<users> { for $user in //users let $comments = //comment[@uid = $user/@id] where count($comments) > 0 order by $user/lastName, $user/firstName return <user id="{ $user/@id }"> <name>{ concat($user.firstName, " ", $user.lastName) }</name> <comments count="count($comments)"> { for $c in $comments return <comment id="{ $c/@id }" /> } </comments> </user> } </users>
http://www.stylusstudio.com/xquery-flwor.html
(: XQuery comments are marked by mirrored smilie faces, like this. :)