Commit 626a5e08 authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

correct counted objects

parent 3b1a9457
......@@ -84,7 +84,28 @@ switch ( $entity/local-name() )
$list/local-name() || "-" || string($list/@type)
};
declare function ixp:get-icon-by-entity($entity as node())
(:~
: Returns the prefix used in the TEI documents to refere to a index file.
: @param $entity an element from the index (e.g. tei:person)
:)
declare function ixp:get-prefix-by-entity($entity as element(*))
as xs:string{
switch($entity/base-uri())
case "/db/sade-projects/textgrid/data/xml/data/253t0.xml"
return "eve"
case "/db/sade-projects/textgrid/data/xml/data/253t2.xml"
return "plc"
case "/db/sade-projects/textgrid/data/xml/data/253t1.xml"
return "org"
case "/db/sade-projects/textgrid/data/xml/data/253sx.xml"
return "psn"
case "/db/sade-projects/textgrid/data/xml/data/253t3.xml"
return "wrk"
default
return error(QName("FONTANE", "INDEX2"), "entity resource is not considered to belong to the index: " || $entity/base-uri())
};
declare function ixp:get-icon-by-entity($entity as element(*))
as xs:string {
switch ( $entity/local-name() )
case "event" return "fa-flag"
......@@ -533,7 +554,9 @@ as element(xhtml:li)* {
:)
declare function ixp:links-new($entity as element()) {
let $id := string($entity/@xml:id)
let $mentions := $ixp:dataCollection//tei:rs[contains(@ref, ":" || $id)][not(@prev)]
let $prefix := ixp:get-prefix-by-entity($entity)
let $reference := $prefix || ":" || $id
let $mentions := $ixp:dataCollection//tei:rs[contains(@ref, $reference)][not(@prev)]
let $countOverAll := count($mentions)
let $base-uris := ($mentions ! base-uri()) => distinct-values()
let $countNotebooks := count($base-uris)
......@@ -545,9 +568,8 @@ return
element xhtml:ul {
(: main list :)
for $uri in $base-uris
(: let $pageList := $mentions[base-uri() = $uri] ! ./ancestor::tei:surface[last()]/string(@n):)
let $doc := doc($uri)
let $pageList := $doc//tei:rs[contains(@ref, ":" || $id)][not(@prev)]/ancestor::tei:surface[parent::tei:sourceDoc]
let $pageList := $doc//tei:rs[contains(@ref, $reference)][not(@prev)]/ancestor::tei:surface[parent::tei:sourceDoc]
let $tguri := ($uri => tokenize("/"))[last()]
let $resolve := ixp:resolve-name(substring-before($tguri, ".xml"))
let $name := $resolve => replace("([A-E])0(\d)", "$1$2")
......@@ -558,7 +580,7 @@ return
element xhtml:ul {
attribute class {"link-list-horizontal"},
for $surface in $pageList
let $count := count( $surface//tei:rs[contains(@ref, ":" || $id)][not(@prev)] )
let $count := count( $surface//tei:rs[contains(@ref, $reference)][not(@prev)] )
return
element xhtml:li {
element xhtml:a {
......
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