Skip to content
Snippets Groups Projects
Commit 825181d8 authored by Christian Schaper's avatar Christian Schaper
Browse files

Datum-Fallunterscheidung vervollständigt

parent 26a193bd
No related branches found
No related tags found
No related merge requests found
......@@ -109,8 +109,12 @@ declare function date:format-date($date as xs:date, $picture as xs:string, $lang
declare function date:printDate($date as element()?, $lang as xs:string, $get-language-string as function(xs:string, xs:string*) as xs:string, $get-picture-string as function(empty()) as xs:string) as xs:string? {
if($date) then (
let $picture-string := $get-picture-string() (: if($lang = 'de') then '[D]. [MNn] [Y]' else '[MNn] [D], [Y]':)
let $notBefore := if($date/@notBefore) then date:getCastableDate(data($date/@notBefore),false()) else()
let $notAfter := if($date/@notAfter) then date:getCastableDate(data($date/@notAfter),true()) else()
let $notBefore := if($date/@notBefore) then date:getCastableDate(data($date/@notBefore),false())
else if($date/@notBefore-iso) then date:getCastableDate(data($date/@notBefore-iso),false())
else()
let $notAfter := if($date/@notAfter) then date:getCastableDate(data($date/@notAfter),true())
else if($date/@notAfter-iso) then date:getCastableDate(data($date/@notAfter-iso),true())
else()
let $from := if($date/@from) then date:getCastableDate(data($date/@from),false())
else if($date/@from-iso) then date:getCastableDate(data($date/@from-iso),false())
else if($date/@when-iso and contains($date/@when-iso, '/')) then date:getCastableDate(data(substring-before($date/@when-iso, '/')),false())
......@@ -119,6 +123,8 @@ declare function date:printDate($date as element()?, $lang as xs:string, $get-la
else if($date/@to-iso) then date:getCastableDate(data($date/@to-iso),true())
else if($date/@when-iso and contains($date/@when-iso, '/')) then date:getCastableDate(data(substring-after($date/@when-iso, '/')),true())
else()
let $notBefore_o := if($date/@notBefore-iso) then string($date/@notBefore-iso) else()
let $notAfter_o := if($date/@notAfter-iso) then string($date/@notAfter-iso) else()
let $from_o := if($date/@from-iso) then string($date/@from-iso)
else if($date/@when-iso and contains($date/@when-iso, '/')) then substring-before($date/@when-iso, '/')
else()
......@@ -144,25 +150,62 @@ declare function date:printDate($date as element()?, $lang as xs:string, $get-la
if(exists($notAfter)) then
if(year-from-date($notBefore) eq year-from-date($notAfter)) then
if(month-from-date($notBefore) eq month-from-date($notAfter)) then
if(day-from-date($notBefore) = 1 and day-from-date($notAfter) = functx:days-in-month($notAfter)) then concat($get-language-string(concat('month',month-from-date($notAfter)),$lang),' ',date:formatYear(year-from-date($notAfter), $lang)) (: August 1879 :)
else $get-language-string('dateBetween',(xs:string(day-from-date($notBefore)),date:format-date($notAfter,$picture-string, $lang))) (: Zwischen 1. und 7. August 1801 :)
else if(ends-with($notBefore, '01-01') and ends-with($notAfter, '12-31')) then date:formatYear(year-from-date($notBefore), $lang) (: 1879 :)
if(day-from-date($notBefore) = 1 and day-from-date($notAfter) = functx:days-in-month($notAfter)) then concat($get-language-string(concat('month',month-from-date($notAfter)),$lang),' ',date:formatYear(year-from-date($notAfter), $lang)) (: August 1879 :)
else $get-language-string('dateBetween',(xs:string(day-from-date($notBefore)),date:format-date($notAfter,$picture-string, $lang))) (: Zwischen 1. und 7. August 1801 :)
else if(ends-with($notBefore, '01-01') and ends-with($notAfter, '12-31')) then date:formatYear(year-from-date($notBefore), $lang) (: 1879 :)
else if($notBefore_o castable as xs:gYearMonth) then
if($notAfter_o castable as xs:gYearMonth) then $get-language-string('dateBetween',(xs:string(date:format-date($notBefore,'[MNn]', $lang)),date:format-date($notAfter,'[MNn] [Y]', $lang))) (: Zwischen Mai und August 1909 :)
else $get-language-string('dateBetween',(xs:string(date:format-date($notBefore,'[MNn]', $lang)),date:format-date($notAfter,$picture-string, $lang))) (: Zwischen Mai und 8. August 1909 :)
else if($notAfter_o castable as xs:gYearMonth) then $get-language-string('dateBetween', (xs:string(date:format-date($notBefore,$picture-string, $lang)),date:format-date($notAfter,'[MNn] [Y]', $lang))) (: Zwischen 1. Juli 1789 und August 1789 :)
else $get-language-string('dateBetween', (replace(date:format-date($notBefore,$picture-string, $lang), '(,\s+)?' || year-from-date($notBefore), ''), date:format-date($notAfter,$picture-string, $lang))) (: Zwischen 1. Juli 1789 und 4. August 1789 :)
else $get-language-string('dateBetween', (date:format-date($notBefore,$picture-string, $lang), date:format-date($notAfter,$picture-string, $lang))) (: Zwischen 1. Juli 1709 und 4. August 1789 :)
else $get-language-string('dateNotBefore', (date:format-date($notBefore,$picture-string, $lang))) (: Frühestens am 1.Juli 1709 :)
else if(exists($notAfter)) then $get-language-string('dateNotAfter', (date:format-date($notAfter,$picture-string, $lang))) (: Spätestens am 1.Juli 1709 :)
else if($notBefore_o castable as xs:gYear) then
if($notAfter_o castable as xs:gYear) then $get-language-string('dateBetween',(date:formatYear(year-from-date($notBefore), $lang),date:formatYear(year-from-date($notAfter), $lang))) (: Zwischen 1879 und 1881 :)
else if($notAfter_o castable as xs:gYearMonth) then $get-language-string('dateBetween',(date:formatYear(year-from-date($notBefore), $lang),date:format-date($notAfter,'[MNn] [Y]', $lang))) (: Zwischen 1879 und März 1881 :)
else $get-language-string('dateBetween', (date:formatYear(year-from-date($notBefore), $lang), date:format-date($notAfter,$picture-string, $lang))) (: Zwischen 1709 und 4. August 1789 :)
else if($notBefore_o castable as xs:gYearMonth) then
if($notAfter_o castable as xs:gYear) then $get-language-string('dateBetween',(date:format-date($notAfter,'[MNn] [Y]', $lang),date:formatYear(year-from-date($notAfter), $lang))) (: Zwischen März 1879 und 1881 :)
else if($notAfter_o castable as xs:gYearMonth) then $get-language-string('dateBetween',(date:format-date($notAfter,'[MNn] [Y]', $lang),date:format-date($notAfter,'[MNn] [Y]', $lang))) (: Zwischen März 1879 und März 1881 :)
else $get-language-string('dateBetween', (date:formatYear(year-from-date($notBefore), $lang), date:format-date($notAfter,$picture-string, $lang))) (: zwischen Mai 1709 und 4. August 1789 :)
else if($notAfter_o castable as xs:gYear) then $get-language-string('dateBetween', (date:format-date($notBefore,$picture-string, $lang), date:formatYear(year-from-date($notAfter), $lang))) (: Zwischen 1. Juli 1709 und 1789 :)
else if($notAfter_o castable as xs:gYearMonth) then $get-language-string('dateBetween', (date:format-date($notBefore,$picture-string, $lang), date:format-date($notAfter,'[MNn] [Y]', $lang))) (: Zwischen 1. Juli 1709 und August 1789 :)
else $get-language-string('dateBetween', (date:format-date($notBefore,$picture-string, $lang), date:format-date($notAfter,$picture-string, $lang))) (: Zwischen 1. Juli 1709 und 4. August 1789 :)
else if($notBefore_o castable as xs:gYear) then $get-language-string('dateNotBefore', (date:formatYear(year-from-date($notBefore), $lang))) (: Frühestens 1709 :)
else if($notBefore_o castable as xs:gYearMonth) then $get-language-string('dateNotBefore', (date:format-date($notBefore,'[MNn] [Y]', $lang))) (: Frühestens Juli 1709 :)
else $get-language-string('dateNotBefore', (date:format-date($notBefore,$picture-string, $lang))) (: Frühestens 1. Juli 1709 :)
else if(exists($notAfter)) then
if($notAfter_o castable as xs:gYear) then $get-language-string('dateNotAfter', (date:formatYear(year-from-date($notAfter), $lang))) (: Spätestens 1709 :)
else if($notAfter_o castable as xs:gYearMonth) then $get-language-string('dateNotAfter', (date:format-date($notAfter,'[MNn] [Y]', $lang))) (: Spätestens Juli 1709 :)
else $get-language-string('dateNotAfter', (date:format-date($notAfter,$picture-string, $lang))) (: Spätestens 1. Juli 1709 :)
else if(exists($from)) then
if(exists($to)) then
if(year-from-date($from) eq year-from-date($to)) then
if(month-from-date($from) eq month-from-date($to)) then
if(day-from-date($from) = 1 and day-from-date($to) = functx:days-in-month($to) and $from_o castable as xs:gYearMonth) then date:format-date($from,'[MNn] [Y]', $lang) (: August 1879 :)
else $get-language-string('fromTo',(xs:string(day-from-date($from)),date:format-date($to,$picture-string, $lang))) (: Vom 1. bis 7. August 1801 :)
else if(ends-with($from, '01-01') and ends-with($to, '12-31')) then date:formatYear(year-from-date($from), $lang) (: 1879 :)
else if($from_o castable as xs:gYearMonth and $to_o castable as xs:gYearMonth) then $get-language-string('noFromTo',(date:format-date($from,'[MNn]', $lang),date:format-date($to,'[MNn] [Y]', $lang))) (: Mai bis August 1909 :)
if(day-from-date($from) = 1 and day-from-date($to) = functx:days-in-month($to)) then date:format-date($from,'[MNn] [Y]', $lang) (: August 1879 :)
else $get-language-string('fromTo',(xs:string(day-from-date($from)),date:format-date($to,$picture-string, $lang))) (: Vom 1. bis 7. August 1801 :)
else if(ends-with($from, '01-01') and ends-with($to, '12-31')) then date:formatYear(year-from-date($from), $lang) (: 1879 :)
else if($from_o castable as xs:gYearMonth) then
if($to_o castable as xs:gYearMonth) then $get-language-string('noFromTo',(date:format-date($from,'[MNn]', $lang),date:format-date($to,'[MNn] [Y]', $lang))) (: Mai bis August 1909 :)
else $get-language-string('noFromTo',(date:format-date($from,'[MNn]', $lang),date:format-date($to,$picture-string, $lang))) (: Mai bis 8. August 1909 :)
else if($to_o castable as xs:gYearMonth) then $get-language-string('noFromTo',(replace(date:format-date($from,$picture-string, $lang), '(,\s+)?' || date:formatYear(year-from-date($from), $lang), ''), date:format-date($to,'[MNn] [Y]', $lang))) (: 4. Juli bis August 1789 :)
else $get-language-string('fromTo', (replace(date:format-date($from,$picture-string, $lang), '(,\s+)?' || date:formatYear(year-from-date($from), $lang), ''), date:format-date($to,$picture-string, $lang))) (: Vom 1. Juli bis 4. August 1789 :)
else $get-language-string('fromTo', (date:format-date($from,$picture-string, $lang), date:format-date($to,$picture-string, $lang))) (: Vom 1. Juli 1709 bis 4. August 1789 :)
else $get-language-string('fromToUnknown', date:format-date($from,$picture-string, $lang)) (: Vom 1.Juli 1709 bis unbekannt :)
else if(exists($to)) then $get-language-string('unknownTo', (date:format-date($to,$picture-string, $lang))) (: von unbekannt bis 1.Juli 1709 :)
else if($from_o castable as xs:gYear) then
if($to_o castable as xs:gYear) then $get-language-string('noFromTo',(date:formatYear(year-from-date($from), $lang),date:formatYear(year-from-date($to), $lang))) (: 1879 bis 1881 :)
else if($to_o castable as xs:gYearMonth) then $get-language-string('noFromTo',(date:formatYear(year-from-date($from), $lang),date:format-date($to,'[MNn] [Y]', $lang))) (: 1879 bis März 1881 :)
else $get-language-string('noFromTo', (date:formatYear(year-from-date($from), $lang), date:format-date($to,$picture-string, $lang))) (: 1709 bis 4. August 1789 :)
else if($from_o castable as xs:gYearMonth) then
if($to_o castable as xs:gYear) then $get-language-string('noFromTo',(date:format-date($from,'[MNn] [Y]', $lang),date:formatYear(year-from-date($to), $lang))) (: März 1879 bis 1881 :)
else if($to_o castable as xs:gYearMonth) then $get-language-string('noFromTo',(date:format-date($from,'[MNn] [Y]', $lang),date:format-date($to,'[MNn] [Y]', $lang))) (: März 1879 bis März 1881 :)
else $get-language-string('noFromTo', (date:format-date($from,'[MNn] [Y]', $lang), date:format-date($to,$picture-string, $lang))) (: Mai 1709 bis 4. August 1789 :)
else if($to_o castable as xs:gYear) then $get-language-string('fromTo', (date:format-date($from,$picture-string, $lang), date:formatYear(year-from-date($to), $lang))) (: Vom 1. Juli 1709 bis 1789 :)
else if($to_o castable as xs:gYearMonth) then $get-language-string('fromTo', (date:format-date($from,$picture-string, $lang), date:format-date($to,'[MNn] [Y]', $lang))) (: Vom 1. Juli 1709 bis August 1789 :)
else $get-language-string('fromTo', (date:format-date($from,$picture-string, $lang), date:format-date($to,$picture-string, $lang))) (: Vom 1. Juli 1709 bis 4. August 1789 :)
else if($from_o castable as xs:gYear) then $get-language-string('fromToUnknown', date:formatYear(year-from-date($from), $lang)) (: seit 1709 bis unbekannt :)
else if($from_o castable as xs:gYearMonth) then $get-language-string('fromToUnknown', date:format-date($from,'[MNn] [Y]', $lang)) (: von Juli 1709 bis unbekannt :)
else $get-language-string('fromToUnknown', date:format-date($from,$picture-string, $lang)) (: Vom 1. Juli 1709 bis unbekannt :)
else if(exists($to)) then
if ($to_o castable as xs:gYear) then $get-language-string('unknownTo', (date:formatYear(year-from-date($to), $lang))) (: von unbekannt bis 1709 :)
else if ($to_o castable as xs:gYearMonth) then $get-language-string('unknownTo', (date:format-date($to,'[MNn] [Y]', $lang))) (: von unbekannt bis Juli 1709 :)
else $get-language-string('unknownTo', (date:format-date($to,$picture-string, $lang))) (: von unbekannt bis 1. Juli 1709 :)
else if(normalize-space($date) castable as xs:date) then date:format-date(xs:date(normalize-space($date)),$picture-string, $lang)
else $get-language-string('dateUnknown', ())
return
......
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