Commit fb1124b5 authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

better performance on former_or_current_location

parent ac5d025e
......@@ -89,6 +89,19 @@ switch ( $entity/local-name() )
$list/local-name() || "-" || string($list/@type)
};
declare function local:get-icon-by-entity($entity as node())
as xs:string {
switch ( $entity/local-name() )
case "event" return "fa-flag"
case "org" return "fa-university"
case "person" return "fa-user"
case "personGrp" return "fa-users"
case "place" return "fa-map-marker"
case "item" return "fa-book"
default return
"fa-exclamation-triangle"
};
(:~
: Helper function to use an efficient map data type to store the model.
:)
......@@ -404,17 +417,21 @@ element xhtml:li {
}
};
(: -> A (irgendein Ding) hat_derzeitigen_Aufbewahrungsort B (irgendein Ort) :)
declare function local:has-former-or-current-location($links as element(tei:link)*)
as element(xhtml:li)* {
for $link in $links
let $id := $link/@target => substring-after(" ") => substring-after(":")
let $thisId := string($link/parent::tei:linkGrp/parent::tei:*/@xml:id)
let $id := ($link/@target => replace("#|\w{3}:", "") => tokenize(" "))[. != $thisId]
let $targetNode := $f-indexproc:dataCollection/id($id)
let $list := local:get-list-by-entity($targetNode)
let $icon := local:get-icon-by-entity($targetNode)
return
element xhtml:li {
attribute class { "former-or-current-location" },
element xhtml:a {
attribute href { "register-listPlace.html?e=" || $id },
<xhtml:i class="fa fa-map-marker" aria-hidden="true"></xhtml:i>,
attribute href { "register-" || $list || ".html?e=" || $id },
<xhtml:i class="fa {$icon}" aria-hidden="true"></xhtml:i>,
"&#160;",
$targetNode/*[1]/string(),
let $ancestors := $targetNode/ancestor::tei:place
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment