diff --git a/add/data/xqm/edition.xqm b/add/data/xqm/edition.xqm index e0d3b383a..adbf87c84 100644 --- a/add/data/xqm/edition.xqm +++ b/add/data/xqm/edition.xqm @@ -79,7 +79,10 @@ declare function edition:getLanguageFileURI($uri as xs:string, $lang as xs:strin if(doc-available($uri)) then doc($uri) else - doc(edition:findEdition($uri)) + if(edition:findEdition($uri)) then + doc(edition:findEdition($uri)) + else + () ) return if ($doc//edirom:language[@xml:lang eq $lang]/@xlink:href => string() != "") then @@ -141,7 +144,7 @@ declare function edition:getPreferencesURI($uri as xs:string?) as xs:string { : @param $editionID The '@xml:id' of the edirom:edition document to process : @return The URI of the Edition file :) -declare function edition:findEdition($editionID as xs:string?) as xs:string { +declare function edition:findEdition($editionID as xs:string?) as xs:string? { if(not($editionID) or $editionID eq '') then( let $edition := (collection('/db/apps')//edirom:edition)[1] diff --git a/add/index.xql b/add/index.xql index f5125fcf0..10b4cdfed 100755 --- a/add/index.xql +++ b/add/index.xql @@ -20,8 +20,8 @@ declare option output:omit-xml-declaration "yes"; (: VARIABLE DECLARATIONS =================================================== :) declare variable $edition := request:get-parameter("edition", ""); -declare variable $editionUri := edition:findEdition($edition); -declare variable $preferences := doc(edition:getPreferencesURI($editionUri)); +declare variable $editionUri := if($edition) then edition:findEdition($edition) else(); +declare variable $preferences := if($editionUri) then(doc(edition:getPreferencesURI($editionUri))) else(); let $eoEditionFiles := collection('/db/apps')//edirom:edition[@xml:id] let $eoEditionFilesCount := count($eoEditionFiles) @@ -46,101 +46,63 @@ let $comment := comment{" " } -let $eoEditionFileSingle := -
- -