Skip to content

Instantly share code, notes, and snippets.

@grtjn
Created October 20, 2011 06:45
Show Gist options
  • Save grtjn/1300569 to your computer and use it in GitHub Desktop.
Save grtjn/1300569 to your computer and use it in GitHub Desktop.
A small example of XQuery code that searches for books with the string ‘XQuery’ in its title..
xquery version '1.0';
(: A small example of XQuery code that searches for books with the string ‘XQuery’ in its title.. :)
<html>
<body>
<ul>{
(: Search all books :)
for $b in collection('books')/book
(: Take those with XQuery in its title :)
where contains($b/title, 'XQuery')
(: Make an HTML result list out of it :)
return
<li>{ data($b/title) }</li>
}</ul>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment