[xquery-talk] XQuery web APIs

Per Bothner per at bothner.com
Tue May 16 13:48:16 PDT 2006


Martin Probst wrote:
> I'm currently trying to add some basic functionality to use XQuery as a 
> web scripting language to X-Hive/DB. It's currently possible to use it 
> that way, but it's somewhat painful.

Simple how-to for using Qexo:
http://www.gnu.org/software/qexo/simple-xquery-webapp.html

Older, more complex example:
http://www.gnu.org/software/qexo/servlet.html

Qexo provides a functional way of setting the response-header:
http://www.gnu.org/software/kawa/HTTP-response.html
(The manual emphasises the Scheme language rather the XQuery,
but there functions are also available.)
Basically the "response-header" is pre-pended to the data.
Here is a little example:

declare boundary-space preserve;
response-header("X-Count", 6+7),
unescaped-data("<?xml version='1.0'?>
"),
<body>
   <p>The translated path was: {request-path-translated()}</p>,
   <p>{let $query := qexo:request-query-string() return
       if ($query)
       then ("The query string was: ",$query)
       else "There was no query string."}</p>
</body>
-- 
	--Per Bothner
per at bothner.com   http://per.bothner.com/


More information about the talk mailing list