diff --git a/modules/bibl.xqm b/modules/bibl.xqm index 680cc0bcf..b77028fdd 100644 --- a/modules/bibl.xqm +++ b/modules/bibl.xqm @@ -1,4 +1,4 @@ -xquery version "3.0" encoding "UTF-8"; +xquery version "3.1" encoding "UTF-8"; module namespace bibl="http://xquery.weber-gesamtausgabe.de/modules/bibl"; @@ -62,6 +62,7 @@ declare function bibl:printGenericCitation($biblStruct as element(tei:biblStruct $authors, if(exists($authors)) then ', ' else (), $title, + bibl:idno($biblStruct/*/tei:idno), $note } }; @@ -95,6 +96,7 @@ declare function bibl:printBookCitation($biblStruct as element(tei:biblStruct), if($biblStruct/tei:monogr/tei:imprint/tei:biblScope[@unit = 'vol']) then bibl:print-single-biblScope-unit((), $biblStruct/tei:monogr/tei:imprint/tei:biblScope[@unit = 'vol'], $lang) || ', ' else (), $pubPlaceNYear, if($biblStruct/tei:monogr/tei:imprint/tei:biblScope[@unit = 'pp']) then bibl:print-single-biblScope-unit(', ', $biblStruct/tei:monogr/tei:imprint/tei:biblScope[@unit = 'pp'], $lang) else (), + bibl:idno($biblStruct/tei:monogr/tei:idno), $note } }; @@ -121,6 +123,7 @@ declare function bibl:printArticleCitation($biblStruct as element(tei:biblStruct if($articleTitle) then (bibl:printTitles($articleTitle, ()), ', in: ') else (), $journalCitation/xhtml:span, $journalCitation/text(), + bibl:idno($biblStruct/tei:analytic/tei:idno), $note } }; @@ -153,6 +156,7 @@ declare function bibl:printIncollectionCitation($biblStruct as element(tei:biblS if(exists($series)) then (' ',({$series})) else (), if(exists($pubPlaceNYear)) then (', ', $pubPlaceNYear) else(), if($biblStruct/tei:monogr/tei:imprint/tei:biblScope[@unit = 'pp']) then concat(', ', lang:get-language-string('pp', $lang), ' ', bibl:normalize-hyphen($biblStruct/tei:monogr/tei:imprint/tei:biblScope[@unit = 'pp'])) else (), + bibl:idno($biblStruct/tei:analytic/tei:idno), $note } }; @@ -358,3 +362,15 @@ declare %private function bibl:printNote($notes as element(tei:note)*, $lang as declare %private function bibl:normalize-hyphen($biblScope as element(tei:biblScope)) as xs:string { replace($biblScope, '-', '–') }; + +(:~ + : Process idno elements to output DOIs and alike + :) +declare %private function bibl:idno($idnos as element(tei:idno)*) as element(xhtml:span)* { + for $idno in $idnos + return + switch($idno/@type) + case 'DOI' return , DOI: {$idno => data(), ' '} + case 'WeGA' return , Volltext verfügbar unter {$idno => data()} + default return , online unter {$idno => data(), ' '} +}; diff --git a/testing/xqsuite/biblio-tests.xqm b/testing/xqsuite/biblio-tests.xqm index 05e09f39a..5d6ff63e6 100644 --- a/testing/xqsuite/biblio-tests.xqm +++ b/testing/xqsuite/biblio-tests.xqm @@ -23,7 +23,7 @@ declare %test:args('A111355') %test:assertEquals("Enchanted Wanderer. The Life of Carl Maria von Weber") %test:args('A111377') %test:assertEquals("Die Beziehungen Carl Maria v. Webers zu thüringischen Musikern") %test:args('A111038') %test:assertEquals("„… wer Flöte bläst, kauft doch allemahl von meinen Werken“. Anton Bernhard Fürstenaus Briefkontakte zum Verlag B. Schott’s Söhne zwischen 1819 und 1825") - %test:args('A111057') %test:assertEquals("Die Rezeption von Carl Maria von Webers „Der Freischütz“ als deutsche Nationaloper. Diplomarbeit zum Magistra der Philosophie (Mag. phil.) an der Universität Wien") + %test:args('A111057') %test:assertEquals("Die Rezeption von Carl Maria von Webers „Der Freischütz“ als deutsche Nationaloper. Diplomarbeit zum Magistra der Philosophie (Mag. phil.) an der Universität Wien") %test:args('A111055') %test:assertEquals("Das Freischütz-Libretto: Quellensituation und intertextuelle Referenzen") function bt:test-title($a as xs:string) as element()+ { let $doc := crud:doc($a) @@ -68,3 +68,27 @@ declare return bibl:printCitation($doc/tei:biblStruct, , 'de')//xhtml:span[@class='placeNYear'] }; + +declare + %test:args('A111057') %test:assertXPath("$result//xhtml:span[@class='idno_DOI'] and $result//xhtml:span[@class='title'] and $result//xhtml:span[@class='author'] and $result//xhtml:span[@class='placeNYear']") + function bt:test-printBookCitation($a as xs:string) as element() { + let $doc := crud:doc($a) + return + bibl:printBookCitation($doc/tei:biblStruct, , 'de') +}; + +declare + %test:args('A112915') %test:assertXPath("$result//xhtml:span[@class='idno_URI'] and $result//xhtml:span[@class='title'] and $result//xhtml:span[@class='author'] and $result//xhtml:span[@class='journalTitle']") + function bt:test-printArticleCitation($a as xs:string) as element() { + let $doc := crud:doc($a) + return + bibl:printArticleCitation($doc/tei:biblStruct, , 'de') +}; + +declare + %test:args('A113081') %test:assertXPath("$result//xhtml:span[@class='idno_DOI'] and $result//xhtml:span[@class='title'] and $result//xhtml:span[@class='author'] and $result//xhtml:span[@class='collectionTitle'] and $result//xhtml:span[@class='editor'] and $result//xhtml:span[@class='placeNYear'] and $result//xhtml:span[@class='seriesTitle']") + function bt:test-printIncollectionCitation($a as xs:string) as element() { + let $doc := crud:doc($a) + return + bibl:printIncollectionCitation($doc/tei:biblStruct, , 'de') +};