diff --git a/add/data/xql/getAnnotationsInText.xql b/add/data/xql/getAnnotationsInText.xql index d522e506..206c8b9c 100644 --- a/add/data/xql/getAnnotationsInText.xql +++ b/add/data/xql/getAnnotationsInText.xql @@ -49,13 +49,12 @@ declare function local:getAnnotations($uriSharp as xs:string, $annotations as el let $plist as array(*) := array { for $p in tokenize($annotation/@plist, '\s+') + where starts-with($p, $uriSharp) return - if (starts-with($p, $uriSharp)) then - (concat('{id:"', $id, '__', substring-after($p, $uriSharp), '"}')) - else - () + map { + 'id': concat( $id, '__', substring-after($p, $uriSharp)) + } } - let $plist := string-join($plist, ',') return map { 'id': $id, diff --git a/add/data/xqm/teitext.xqm b/add/data/xqm/teitext.xqm index 407a356b..59cb7fb4 100644 --- a/add/data/xqm/teitext.xqm +++ b/add/data/xqm/teitext.xqm @@ -28,7 +28,7 @@ declare namespace tei="http://www.tei-c.org/ns/1.0"; :) declare function teitext:isText($uri as xs:string) as xs:boolean { - exists(doc($uri)/tei:TEI) + exists(eutil:getDoc($uri)/tei:TEI) }; @@ -40,8 +40,6 @@ declare function teitext:isText($uri as xs:string) as xs:boolean { :) declare function teitext:getLabel($uri as xs:string, $edition as xs:string) as xs:string { - let $language := eutil:getLanguage($edition) - - return doc($uri)//tei:titleStmt/data(tei:title[not(@xml:lang) or @xml:lang = $language]) + eutil:getLocalizedTitle(eutil:getDoc($uri), eutil:getLanguage($edition)) };