You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function routes:document($resource as xs:string, $ref as xs:string, $start as xs:string, $end as xs:string, $tree as xs:string, $mediaType as xs:string, $filter) {
(: ce système de paramètre pourrai être stocker dans global.xqm:)
let $mapMedia :=
map{'html': map{'Content-Type' : 'text/html','xsl':'hteiml/tei2html.xsl'},
'text': map{'Content-Type' : 'text/plain', ,xsl':'hteiml/tei2text.xsl'}
}
(: a voir si ajouter un paramètre mode pour spécifier le mode de stockage est pertinent :)
return
if ($resource != "")
then
let $dbName := db:get($G:dots)//dots:member/node()[@dtsResourceId = $resource]/@dbName
return
if ($dbName)
then
let $result := utils:document($resource, $ref, $start, $end, $tree, $filter)
return
if ($mediaType)
then
if (map:contains($mapMedia,$mediaType))
(:ici il y a surement moyen d'optimiser le code car on a 2 fois le rest: réponse :)
then(
let $f := map:get(map:get($mapMedia,$mediaType),'Content-Type')
let $style := concat($G:xsl,map:get(map:get($mapMedia,$mediaType),'xsl'))
let $result := switch (map:get(map:get($mapMedia,$mediaType),'method'))
case 'text'
return xslt:transform-text($result, $style)
case 'xml'
return xslt:transform($result, $style)
default
return "unknown"
return (
<rest:response>
<http:response status="200">
<http:header name="Content-Type" value="{concat($f, ' charset=utf-8')}"/>
</http:response>
</rest:response>,
$result ))
else(
<rest:response>
<http:response status="200">
<http:header name="Content-Type" value="application/xml+tei"/>
</http:response>
</rest:response>,
$result
)
else
$result
else
routes:badIdResource(xs:string($resource))
else
routes:badIdResource(xs:string($resource))
};
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: