Skip to content

Commit

Permalink
Merge pull request #483 from Edirom/issue-482
Browse files Browse the repository at this point in the history
suppress empty dates in the CMIF output
  • Loading branch information
peterstadler authored Oct 4, 2024
2 parents 6922893 + d619c96 commit b8cfd47
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions modules/cmif.xql
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
xquery version "3.1" encoding "UTF-8";

(:~
: XQuery for creating a CMIF file from the correspondence descriptions of the WeGA letters
: @see https://correspsearch.net/en/documentation.html
:)

declare namespace tei="http://www.tei-c.org/ns/1.0";
declare namespace exist="http://exist.sourceforge.net/NS/exist";
declare namespace ct="http://wiki.tei-c.org/index.php/SIG:Correspondence/task-force-correspDesc";
Expand Down Expand Up @@ -149,14 +154,18 @@ declare function ct:place($input as element()) as element(tei:placeName) {
}
};

declare function ct:date($input as element()) as element(tei:date) {
element {QName('http://www.tei-c.org/ns/1.0', local-name($input))} {
$input/@*[not(local-name(.) = ('n', 'calendar'))]
(:
no content allowed here with the schema at
https://raw.githubusercontent.com/TEI-Correspondence-SIG/CMIF/master/schema/cmi-customization.rng
:)
}
declare function ct:date($input as element()) as element(tei:date)? {
(: The CMIF supports the attributes @when, @from, @to, @notBefore und @notAfter :)
if($input/(@when | @from | @to | @notBefore | @notAfter))
then
element {QName('http://www.tei-c.org/ns/1.0', local-name($input))} {
$input/@*[not(local-name(.) = ('n', 'calendar', 'cert'))]
(:
no content allowed here with the schema at
https://raw.githubusercontent.com/TEI-Correspondence-SIG/CMIF/master/schema/cmi-customization.rng
:)
}
else ()
};

(:~
Expand Down

0 comments on commit b8cfd47

Please sign in to comment.