diff --git a/add/data/xql/getLinkTarget.xql b/add/data/xql/getLinkTarget.xql
index 47f4be40d7a0e63839345d693d5317d96e09d4f8..607a399e04ffae7300f944d57535d27dcd84ab7d 100644
--- a/add/data/xql/getLinkTarget.xql
+++ b/add/data/xql/getLinkTarget.xql
@@ -170,7 +170,7 @@ declare function local:getWindowTitle($doc as node()+, $type as xs:string) as xs
             eutil:getLocalizedTitle($workTitleContainer, $lang)
     
     (: Recording :)
-    else if (exists($doc//mei:mei) and exists($doc//mei:recording)) then
+    else if ($type = 'recording') then
         (eutil:getLocalizedTitle($doc//mei:fileDesc/mei:titleStmt[1], $lang))
     
     (: Source / Score :)
@@ -188,7 +188,7 @@ declare function local:getWindowTitle($doc as node()+, $type as xs:string) as xs
         (eutil:getLocalizedTitle(($doc//mei:titleStmt)[1], $lang))
     
     (: Text :)
-    else if (exists($doc/tei:TEI)) then
+    else if ($type = 'text') then
         (eutil:getLocalizedTitle($doc//tei:fileDesc/tei:titleStmt[1], $lang))
     
     (: HTML :)