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

new link generator based on db data

parent 02814adc
......@@ -467,7 +467,9 @@ return
:)
declare function local:links($links as element(tei:link)*)
as element(xhtml:li) {
let $notebookUris := $links ! (substring-after(./@target, $f-indexproc:targetStart) => substring(1,5) => distinct-values())
let $notebookUris :=
$links ! (substring-after(./@target, $f-indexproc:targetStart) => substring(1,5) => distinct-values())
let $linkMap as map() :=
map:new(
for $nb in $notebookUris
......@@ -521,6 +523,53 @@ as element(xhtml:li)* {
}
};
(:~ renewed version of the linking function
: generates a XHTML list with all links without using the tei:link[@corresp]
: from the entity. it queries the database for what is really mentioned.
:)
declare function f-indexproc:links-new($entity as element()) {
let $id := string($entity/@xml:id)
let $mentions := $f-indexproc:dataCollection//tei:rs[contains(@ref, ":" || $id)][not(@prev)]
let $base-uris := ($mentions ! base-uri()) => distinct-values()
return
element xhtml:li {
attribute class { "links" },
if(count($base-uris) = 1) then 'In Notizbuch' else 'In den Notizbüchern',
element xhtml:ul {
for $uri in $base-uris
let $tguri := ($uri => tokenize("/"))[last()]
let $resolve := local:resolve-name(substring-before($tguri, ".xml"))
let $name := $resolve => replace("([A-E])0(\d)", "$1$2")
order by $resolve
return
element xhtml:li {
$name || ": ",
element xhtml:ul {
attribute class {"link-list-horizontal"},
for $mention in $mentions
let $surface := $mention/ancestor::tei:surface[last()]
let $page := string($surface/@n)
let $count := $surface//tei:rs[contains(@ref, ":" || $id)][not(@prev)] => count()
return
element xhtml:li {
element xhtml:a {
attribute href {
"edition.html?id=%2Fxml%2Fdata%2F" || $tguri
|| "&page=" || $page
|| "&target=" || $id
},
f-misc:n-translate($page),
if($count eq 1) then ()
else (" ", <xhtml:span title="Anzahl an Vorkommnissen auf dieser Seite">({$count})</xhtml:span>)
}
}
}
}
}
}
};
(:~
: prepares a link to the current entry
: @param $id – the xml:id of the currently processed element
......@@ -719,7 +768,7 @@ return
(: bibl :)
local:bibl($bibl),
(: links :)
local:links($links),
f-indexproc:links-new($event),
local:li-code($event)
}
}
......@@ -808,7 +857,7 @@ return
(: bibl :)
local:bibl($bibl),
(: links :)
local:links($links),
f-indexproc:links-new($org),
local:li-code($org)
}
}
......@@ -958,7 +1007,7 @@ else
(: bibl :)
local:bibl($bibl),
(: links :)
local:links($links),
f-indexproc:links-new($pers),
local:li-code($pers)
}
}
......@@ -1083,7 +1132,7 @@ else
(: former_or_current_location :)
local:has-former-or-current-location($formerCurrentLocation),
(: links :)
local:links($links),
f-indexproc:links-new($place),
local:li-code($place),
element xhtml:ul {
for $plac in $place/tei:place
......@@ -1216,7 +1265,7 @@ else
(: former_or_current_location :)
local:has-former-or-current-location($formerCurrentLocation),
(: links :)
local:links($links),
f-indexproc:links-new($work),
local:li-code($work),
(: further entities :)
for $listPerson in $work/tei:listPerson
......
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