From 0f50ee9113deb4414396daeccd310e0f747918d2 Mon Sep 17 00:00:00 2001
From: bwbohl <b.w.bohl@gmail.com>
Date: Thu, 19 Dec 2024 09:21:15 +0100
Subject: [PATCH] getLinkTarget.xql: rely on submitted type in function
 getWindowTitle

Thsi removes doubled 'type' identification that already happens in the $type variable which gets submitted to the call of the getWindowTitle function
---
 add/data/xql/getLinkTarget.xql | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/add/data/xql/getLinkTarget.xql b/add/data/xql/getLinkTarget.xql
index 47f4be40d..607a399e0 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 :)
-- 
GitLab