diff --git a/modules/app.xqm b/modules/app.xqm index 0b3fc529a..0bb6d15da 100644 --- a/modules/app.xqm +++ b/modules/app.xqm @@ -627,20 +627,20 @@ declare %private function app:createLetterLink($teiDate as element(tei:date)?, $ }; (:~ - : Construct a name from a tei:persName or tei:name element wrapped in a - : If a @key is given on persName the regularized form will be returned, otherwise the content of persName. - : If persName is empty than "unknown" is returned. + : Construct a name from a tei:persName, tei:orgName, or tei:name element wrapped in a + : If a @key is given on the element the regularized form will be returned, otherwise the content of the element. + : If the element is empty than "unknown" is returned. : : @author Peter Stadler - : @param $persName the tei:persName element + : @param $persName the tei:persName, tei:orgName, or tei:name element : @param $lang the current language (de|en) - : @param $order (sf|fs) whether to print "surname, forename" or "forename surname" - : @return + : @param $order (sf|fs|s) whether to print "surname, forename", or "forename surname", or just the surname + : @return a html:span element with the constructed name :) -declare function app:printCorrespondentName($persName as element()?, $lang as xs:string, $order as xs:string) as element() { +declare function app:printCorrespondentName($persName as element()?, $lang as xs:string, $order as xs:string) as element(xhtml:span) { if(exists($persName/@key)) then if ($order eq 'fs') then app:createDocLink(crud:doc($persName/string(@key)), wega-util:print-forename-surname-from-nameLike-element($persName), $lang, ('class=' || config:get-doctype-by-id($persName/@key))) - else if ($order eq 's') then app:createDocLink(crud:doc($persName/string(@key)), substring-before(query:title($persName/@key),','), $lang, ('class=preview ' || concat($persName/@key, " ", config:get-doctype-by-id($persName/@key)))) + else if ($order eq 's') then app:createDocLink(crud:doc($persName/string(@key)), functx:substring-before-if-contains(query:title($persName/@key), ', '), $lang, ('class=preview ' || concat($persName/@key, " ", config:get-doctype-by-id($persName/@key)))) else app:createDocLink(crud:doc($persName/string(@key)), query:title($persName/@key), $lang, ('class=' || config:get-doctype-by-id($persName/@key))) else if(not(functx:all-whitespace($persName))) then if ($order eq 'fs') then {wega-util:print-forename-surname-from-nameLike-element($persName)} diff --git a/testing/expected-results/letters/A041782.html b/testing/expected-results/letters/A041782.html index f9e6672bd..09a9c851c 100644 --- a/testing/expected-results/letters/A041782.html +++ b/testing/expected-results/letters/A041782.html @@ -366,7 +366,7 @@

Vorausgehend

1821-05-31: an
  • - 1821-08-16: von + 1821-08-16: von Theaterintendanz Karlsruhe
  • Folgend

    diff --git a/testing/expected-results/letters/A041797.html b/testing/expected-results/letters/A041797.html index 1b675bb9e..ab4dbb361 100644 --- a/testing/expected-results/letters/A041797.html +++ b/testing/expected-results/letters/A041797.html @@ -367,7 +367,7 @@

    Vorausgehend

    1821-09-17: an
  • - 1821-08-16: von + 1821-08-16: von Theaterintendanz Karlsruhe
  • Folgend

    diff --git a/testing/expected-results/letters/A041822.html b/testing/expected-results/letters/A041822.html index bd2485e87..58681cba4 100644 --- a/testing/expected-results/letters/A041822.html +++ b/testing/expected-results/letters/A041822.html @@ -376,7 +376,7 @@

    Vorausgehend

    1821-10-25: an
  • - 1821-08-16: von + 1821-08-16: von Theaterintendanz Karlsruhe
  • Folgend

    diff --git a/testing/expected-results/letters/A041890.html b/testing/expected-results/letters/A041890.html index 48bba101f..b3f6e95cb 100644 --- a/testing/expected-results/letters/A041890.html +++ b/testing/expected-results/letters/A041890.html @@ -367,7 +367,7 @@

    Vorausgehend

    1821-12-17: an
  • - 1821-08-16: von + 1821-08-16: von Theaterintendanz Karlsruhe
  • Folgend

    diff --git a/testing/expected-results/letters/A041892.html b/testing/expected-results/letters/A041892.html index 88664cee0..5da31d161 100644 --- a/testing/expected-results/letters/A041892.html +++ b/testing/expected-results/letters/A041892.html @@ -367,7 +367,7 @@

    Vorausgehend

    1822-01-18: an
  • - 1821-08-16: von + 1821-08-16: von Theaterintendanz Karlsruhe
  • Folgend

    diff --git a/testing/expected-results/letters/A041894.html b/testing/expected-results/letters/A041894.html index bb4ba71da..4142af881 100644 --- a/testing/expected-results/letters/A041894.html +++ b/testing/expected-results/letters/A041894.html @@ -365,7 +365,7 @@

    Vorausgehend

    1822-01-21: an
  • - 1821-08-16: von + 1821-08-16: von Theaterintendanz Karlsruhe
  • Folgend

    diff --git a/testing/expected-results/letters/A042166.html b/testing/expected-results/letters/A042166.html index bfaca52b9..839772aa4 100644 --- a/testing/expected-results/letters/A042166.html +++ b/testing/expected-results/letters/A042166.html @@ -374,7 +374,7 @@

    Folgend

    1824-05-26: an
  • - 1823-12-04: von + 1823-12-04: von Theaterintendanz Karlsruhe
  • diff --git a/testing/expected-results/letters/A045410.html b/testing/expected-results/letters/A045410.html index 2388dfc5a..7f053b869 100644 --- a/testing/expected-results/letters/A045410.html +++ b/testing/expected-results/letters/A045410.html @@ -376,7 +376,7 @@

    Folgend

    1823-11-04: an
  • - 1823-12-04: von + 1823-12-04: von Theaterintendanz Karlsruhe