Commit a9338d2d authored by mrodzis's avatar mrodzis 🌎
Browse files

Add key for indices (cf. print#54)

parent 37cd6654
......@@ -649,8 +649,7 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a
and not($node/@subtype = "footnote")) then
()
else
(fontaneSimple:copy-element($node, $uri),
console:log($node))
fontaneSimple:copy-element($node, $uri)
case element(tei:certainty) return
element {QName("http://www.tei-c.org/ns/1.0", "note")} {
......@@ -945,59 +944,78 @@ $index-type as xs:string) as element()* {
attribute type {"main"},
index-info:get-info-about($index-type, $ref, "regular-name")
},
switch ($index-type)
case "eve" return
let $place := index-info:get-info-about($index-type, $ref, "place")
let $place := index-info:get-info-about("plc", $place, "regular-name")
return
fontaneSimple:make-term("place", $place)
case "org" return
()
element {QName("http://www.tei-c.org/ns/1.0", "term")} {
attribute type {"key"},
let $main := index-info:get-info-about($index-type, $ref, "regular-name")
let $affix := substring-after($main, "\.")
let $key :=
replace($main, "Ä", "A")
=> replace("ä", "a")
=> replace("Ö", "O")
=> replace("ö", "o")
=> replace("Ü", "U")
=> replace("ü", "u")
return
(: sorts terms with a trailer, e.g. 'Friederich II. von Sachsen' after the ones
without, e.g. 'Friederich II.' :)
if(matches($affix, "[\w]")) then
$key || "A"
else
$key
},
switch ($index-type)
case "eve" return
let $place := index-info:get-info-about($index-type, $ref, "place")
let $place := index-info:get-info-about("plc", $place, "regular-name")
return
fontaneSimple:make-term("place", $place)
case "org" return
()
case "plc" return
let $subref := index-info:get-info-about($index-type, $ref, "subref-of")
return
fontaneSimple:make-term("subref-of", $subref)
case "plc" return
let $subref := index-info:get-info-about($index-type, $ref, "subref-of")
return
fontaneSimple:make-term("subref-of", $subref)
case "psn" return
let $birth := index-info:get-info-about($index-type, $ref, "birth")
let $death := index-info:get-info-about($index-type, $ref, "death")
let $occupation := index-info:get-info-about($index-type, $ref, "occupation")
return
(fontaneSimple:make-term("birth", $birth),
fontaneSimple:make-term("death", $death),
fontaneSimple:make-term("occupation", $occupation),
if(index-info:get-info-about($index-type, $ref, "relation-to-fontane")) then
let $relation := index-info:get-info-about($index-type, $ref, "relation-to-fontane")
return
fontaneSimple:make-term("relation-to-fontane", $relation)
else
(),
if(index-info:get-info-about($index-type, $ref, "same-as")) then
let $same-as := index-info:get-info-about($index-type, $ref, "same-as")
return
fontaneSimple:make-term("same-as", $same-as)
else
(),
if(index-info:get-info-about($index-type, $ref, "creator-of")) then
let $creator-of := index-info:get-info-about($index-type, $ref, "creator-of")
return
fontaneSimple:make-term("creator-of", $creator-of)
else
())
case "wrk" return
(: the index "wrk" not only encompasses works but
also fictional characters that occur in them. part-of
denotes this relationship. :)
if(index-info:get-info-about($index-type, $ref, "part-of")) then
let $part-of := index-info:get-info-about($index-type, $ref, "part-of")
case "psn" return
let $birth := index-info:get-info-about($index-type, $ref, "birth")
let $death := index-info:get-info-about($index-type, $ref, "death")
let $occupation := index-info:get-info-about($index-type, $ref, "occupation")
return
(fontaneSimple:make-term("birth", $birth),
fontaneSimple:make-term("death", $death),
fontaneSimple:make-term("occupation", $occupation),
if(index-info:get-info-about($index-type, $ref, "relation-to-fontane")) then
let $relation := index-info:get-info-about($index-type, $ref, "relation-to-fontane")
return
fontaneSimple:make-term("part-of", $part-of)
fontaneSimple:make-term("relation-to-fontane", $relation)
else
()
default return
(),
if(index-info:get-info-about($index-type, $ref, "same-as")) then
let $same-as := index-info:get-info-about($index-type, $ref, "same-as")
return
fontaneSimple:make-term("same-as", $same-as)
else
(),
if(index-info:get-info-about($index-type, $ref, "creator-of")) then
let $creator-of := index-info:get-info-about($index-type, $ref, "creator-of")
return
fontaneSimple:make-term("creator-of", $creator-of)
else
())
case "wrk" return
(: the index "wrk" not only encompasses works but
also fictional characters that occur in them. part-of
denotes this relationship. :)
if(index-info:get-info-about($index-type, $ref, "part-of")) then
let $part-of := index-info:get-info-about($index-type, $ref, "part-of")
return
fontaneSimple:make-term("part-of", $part-of)
else
()
default return
()
}
};
......
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