Skip to content

Commit

Permalink
Only reorder name if surname isn't already at first position
Browse files Browse the repository at this point in the history
fixes #154
  • Loading branch information
cmil committed Jan 14, 2022
1 parent 53d3037 commit 9c43ab5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/util.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,12 @@ declare function dutil:get-short-name (
};

declare function local:build-sort-name ($name as element()) {
if ($name/tei:surname) then
(:
: If there is a surname and it is not the first element in the name we
: rearrange the name to put it first. Otherwise we just return the normalized
: text as written in the document.
:)
if ($name/tei:surname and not($name/tei:*[1] = $name/tei:surname)) then
let $start := if ($name/tei:surname[@sort="1"]) then
$name/tei:surname[@sort="1"] else $name/tei:surname[1]

Expand Down

0 comments on commit 9c43ab5

Please sign in to comment.