Gitlab Community Edition Instance

Skip to content
Snippets Groups Projects
Commit 99f5ecb9 authored by Michelle Weidling's avatar Michelle Weidling :herb:
Browse files

test(textapi): always return a value for x-editor

#54
parent d3d291a1
No related branches found
No related tags found
1 merge request!37Bugfix/#54 edition plain text arabic
......@@ -247,12 +247,19 @@ as element(object) {
:)
declare function tapi:make-editors($documentNode as document-node()) as element(x-editor)* {
let $role := "editor"
for $editor in $documentNode//tei:titleStmt//tei:editor
let $has-editor := exists($documentNode//tei:titleStmt//tei:editor)
return
<x-editor>
<role>{$role}</role>
<name>{$editor/string()}</name>
</x-editor>
if ($has-editor) then
for $editor in $documentNode//tei:titleStmt//tei:editor
return
<x-editor>
<role>{$role}</role>
<name>{$editor/string()}</name>
</x-editor>
else
<x-editor>
<name>none</name>
</x-editor>
};
(:~
......
......@@ -302,6 +302,14 @@ function tests:make-editors() as element()+ {
tapi:make-editors($documentNode)
};
declare
%test:assertXPath("$result[local-name(.) = 'x-editor' and name/text() = 'none']")
function tests:make-editors-fail-gracefully() as element()+ {
let $documentNode := doc("/db/test-records/sample-tei.xml")
return
tapi:make-editors($documentNode)
};
declare
%test:assertXPath("$result[local-name(.) = 'x-date'][text() = '18.10.1697']")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment