Skip to content

Commit

Permalink
Errors fixed and fallback for MEI included again
Browse files Browse the repository at this point in the history
  • Loading branch information
roewenstrunk committed Jan 7, 2025
1 parent 65d1201 commit 60b2926
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions add/data/xql/getLinkTarget.xql
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ declare function local:getWindowTitle($doc as node()+, $type as xs:string) as xs
($doc//mei:source)[1]//mei:identifier[lower-case(@type) = 'shelfmark'][1]), ' | ')
=> normalize-space())

(: MEI fallback if no title is found :)
else if (exists($doc//mei:mei) and exists(($doc//mei:titleStmt)[1])) then
(eutil:getLocalizedTitle(($doc//mei:titleStmt)[1], $lang))

(: Text :)
else if ($type = 'text') then
(eutil:getLocalizedTitle($doc//tei:fileDesc/tei:titleStmt[1], $lang))
Expand All @@ -195,10 +199,10 @@ declare function local:getWindowTitle($doc as node()+, $type as xs:string) as xs

else if($type = 'unknown') then

let $eventualTitleContainers := ($doc//mei:titleStmt, $doc/tei:titleStmt)
let $eventualTitleContainers := ($doc//mei:titleStmt, $doc//tei:titleStmt)
let $eventualTitles := (
for $et in $eventualTitleContainers return
eutil:getLocalizedTitle($eventualTitleContainers[1], $lang),
eutil:getLocalizedTitle($et, $lang),
for $t in $doc//*:title return
$t => normalize-space()
)
Expand Down

0 comments on commit 60b2926

Please sign in to comment.