...
 
Commits (2)
......@@ -234,7 +234,7 @@ else if (matches($exist:path, "/(" || string-join($data-collections, "|") || ")/
<forward url="{$exist:controller}/modules/view.xql"/>
</error-handler>
</dispatch>
else if (ends-with($exist:resource, ".xml")) then
else if (matches($exist:resource, ".xml$", "i")) then
let $docPath := $path || $id
let $template :=
if ($html) then $html else (local:get-template($docPath), $config:default-template)[1]
......
......@@ -173,12 +173,7 @@ declare function pages:load-xml($data as node()*, $view as xs:string?, $root as
if ($root) then
util:node-by-id($data, $root)
else
let $div := ($data//tei:pb)[1]
return
if ($div) then
$div
else
$data/tei:TEI//tei:body
nav:get-first-page-start($config, $data)
case "single" return
if ($root) then
util:node-by-id($data, $root)
......
......@@ -53,6 +53,10 @@ declare function nav:get-metadata($config as map(*), $root as element(), $field
()
};
declare function nav:get-first-page-start($config as map(*), $data as element()) {
()
};
declare function nav:get-content($config as map(*), $div as element()) {
typeswitch($div)
case element(dbk:section) return
......
......@@ -76,6 +76,16 @@ declare function nav:get-metadata($config as map(*), $root as element(), $field
()
};
declare function nav:get-first-page-start($config as map(*), $data as element()) {
let $pb := ($data//tei:pb)[1]
return
if ($pb) then
$pb
else
$data/tei:TEI//tei:body
};
declare function nav:get-content($config as map(*), $div as element()) {
typeswitch ($div)
case element(tei:teiHeader) return
......
......@@ -70,6 +70,10 @@ declare function nav:get-section-heading($config as map(*), $section as node())
nav:dispatch($config, "get-section-heading", [$config, $section])
};
declare function nav:get-first-page-start($config as map(*), $data as node()) {
nav:dispatch($config, "get-first-page-start", [$config, $data])
};
declare function nav:get-content($config as map(*), $div as element()) {
nav:dispatch($config, "get-content", [$config, $div])
};
......
......@@ -201,7 +201,7 @@ else if (ends-with($exist:resource, ".html")) then (
<forward url="{$exist:controller}/modules/view.xql"/>
</error-handler>
</dispatch>
else if (ends-with($exist:resource, ".xml")) then
else if (matches($exist:resource, ".xml$", "i")) then
let $docPath := $path || $id
let $template :=
if ($html) then $html else (local:get-template($docPath), $config:default-template)[1]
......