Commit 20456fe3 authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

closes #41, adds test

parent c10011ca
...@@ -144,7 +144,16 @@ else ...@@ -144,7 +144,16 @@ else
default return "The prefix " || $prefix || " is not in the dictonary." default return "The prefix " || $prefix || " is not in the dictonary."
}; };
declare function local:get-list-by-id($id as xs:string) declare
%test:name("entity list relation")
%test:args("Dom_Karlos_Figur") (: person in wrk :)
%test:assertEquals("list-works")
%test:args("Purschian") (: person :)
%test:assertEquals("listPerson")
function local:get-list-by-id($id as xs:string)
as xs:string { as xs:string {
let $entity := collection($index:dataPath)/id($id) let $entity := collection($index:dataPath)/id($id)
let $test := if($entity[2]) then error(QName("FONTANE", "INDEX-API3"), "Entity »" || $id || "« has more then one occurence." ) else () let $test := if($entity[2]) then error(QName("FONTANE", "INDEX-API3"), "Entity »" || $id || "« has more then one occurence." ) else ()
...@@ -155,11 +164,11 @@ return ...@@ -155,11 +164,11 @@ return
case "place" return "listPlace" case "place" return "listPlace"
case "person" return case "person" return
if($entity/ancestor::tei:item) if($entity/ancestor::tei:item)
then local:get-list-by-id( $entity/ancestor::tei:item[last()]/string(@id) ) then local:get-list-by-id( ($entity/ancestor::tei:item)[last()]/string(@xml:id) )
else "listPerson" else "listPerson"
case "personGrp" return case "personGrp" return
if($entity/ancestor::tei:item) if($entity/ancestor::tei:item)
then local:get-list-by-id( $entity/ancestor::tei:item[last()]/string(@id) ) then local:get-list-by-id( ($entity/ancestor::tei:item)[last()]/string(@xml:id) )
else "listPerson" else "listPerson"
default return default return
let $list := ($entity/ancestor::tei:list[@type])[last()] let $list := ($entity/ancestor::tei:list[@type])[last()]
......
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