module "http://www.w3.org/2003/05/xpath-functions"
define function print-page($title as xs:string, $body as element()*)
as element()
{
xdmp:set-response-content-type("text/html"),
{ $title }
@ { $title }
{
if (count($body)=1)
then
$body/node()
else
$body
,
debug-dump()
}
Powered by
{ xdmp:product-name() }
{ concat(" ",
xdmp:product-edition(),
" edition ver. ",
xdmp:version()) }
Send comments or suggestions to
raff@aromatic.org
}
define function debug-dump() as element()*
{
if (xdmp:get-request-field("debug", "") != "")
then
(
,
| Method: | {xdmp:get-request-method()} |
| Path: | {xdmp:get-request-path()} |
| Client IP: | {xdmp:get-ip()} |
| |
{
for $f in xdmp:get-request-field-names()
return
| {$f} | {xdmp:get-request-field($f)} |
}
| |
{
for $f in xdmp:get-session-field-names()
return
| {$f} | {xdmp:get-session-field($f)} |
}
| |
{
for $f in xdmp:get-request-header-names()
return
| {$f} | {xdmp:get-request-header($f)} |
}
)
else
()
}