How do I run an Xquery script?

I just ran across this thing called Xquery a few hours ago, read up the W3schools tutorial and am very stoked!
Small problem though …
How do I start running Xquery scripts?
I have the files all set up and everything, I know the extension for an xquery file is .xq and .xquery but I don’t know how to actually run this script for instance …

for $x in doc("books.xml")/bookstore/book
order by $x/title
return <li>{data($x/title)}. Category: {data($x/@category)}</li>


You need an XQuery engine to “run” the query. You can find a list of XQuery engines and implementations at the W3C site here.

If you want to run XQuery as a sort of Server Pages technology (like PHP) where you mix HTML markup and XQueries then you could try the Qizx/open engine - just download the war file and drop it into Tomcat’s webapps folder.

XQuery is still developing and it’ll take you some time to get used to all the different implementations/engines available out there…

good luck.