[xquery-talk] XQuery web APIs
Martin Probst
martin at x-hive.com
Wed May 17 09:49:20 PDT 2006
Hi,
>> And if it returns a value, how does that look? Do you use XML or
>> rather have a "magic" value?
>
> It actually is a "bare" attribute node, though it could be a magic
> value.
So that's pretty close to Lars Trieloff's idea about embedding
processing instructions in the return stream. I like the idea of
returning something that is actually valid and nice in XQuery, magic
values tend to get messy in my experience.
>> In my local changes I currently use external variables to pass in
>> parameters from the web request, I get the list of declared
>> external variables from the query, and bind each one to a request
>> parameter if the namespace URI is a certain X-Hive URI and the
>> local name matches the HTTP request parameter name. Writing
>> declare variable $web:req external;
>> seemed somewhat more natural to me than
>> web:get-request-param("req")
>> though the default values have some appeal.
>
> I wish one could supply default values to 'declare variable'.
> Perhaps that might be a worthwhile extension.
Currently I ask for all declared variables in the query and then set
everyone to something, so if there was no query parameter for
$web:foo it just gets an Object[0] and you can test for existence: if
(exists($web:foo)) then $web:foo else $default-val.
> Another idea: $web:req(default-value-expression)
That kind of mixes functions with parameters, no?
Anyhow, if we can get a third implementation aboard it might pay off
to create a common library, don't you think?
Martin
--
Martin Probst
X-Hive Corporation
martin at x-hive.com
More information about the talk
mailing list