xquery version "3.0"; declare variable $exist:path external; declare variable $exist:resource external; declare variable $exist:controller external; declare variable $exist:prefix external; declare variable $exist:root external; if ($exist:path eq '') then else if ($exist:path eq "/") then (: forward root path to index.xql :) else if (contains($exist:path, "/dictionary")) then let $document := concat($exist:root, $exist:controller, $exist:path) let $collection := substring-before($document, $exist:path) let $basename := substring-before($exist:resource, ".") let $extension := substring-after($exist:resource, ".") let $id := substring-after($exist:path, "/dictionary/") let $dict := collection($collection)//id[matches(., $id)]/.. let $description := $dict/description return
{$description}
else if (ends-with($exist:resource, ".html")) then (: the html page is run through view.xql to expand templates :) (: Resource paths starting with $shared are loaded from the shared-resources app :) else if (contains($exist:path, "/$shared/")) then else (: everything else is passed through :)