4 ms·
Everything that isn't a (: happy comments :) is a FLWOR: <users> { for $user in //users let $comments = //comment[@uid = $user/@id] where count
by spiralx 5y ago
Everything that isn't a (: happy comments :) is a FLWOR:
<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>
It's the bastard child of SQL and XPath 2 lol.
http://www.stylusstudio.com/xquery-flwor.html http://www.stylusstudio.com/xquery-flwor.html
- phlummox 5y agoI kinda liked XQuery, but it seemed to never have got much traction.