Almost every package has sample xql files under package/www/...
like file-storage/www/file-copy.xql:
<?xml version="1.0"?>
<queryset>
<fullquery name="file_name">
<querytext>
select name as title
from cr_items
where item_id = :file_id
</querytext>
</fullquery>
</queryset>
So the query file_name is called in the file file-copy.tcl by something like:
db_string file_name {}
or
db_0or1row file_name {}
That's all about xql.
Greetings,
Nima