Skip to content

Commit

Permalink
fixed display of biblStruct within witness
Browse files Browse the repository at this point in the history
  • Loading branch information
peterstadler committed Dec 9, 2014
1 parent 984f267 commit 435877e
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions modules/wega.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -1340,10 +1340,16 @@ declare function wega:printSourceDesc($doc as document-node(), $lang as xs:strin
}
<div>{
(: Drei mögliche Kinder (neben tei:correspDesc) von sourceDesc: tei:msDesc, tei:listWit, tei:biblStruct :)
if(not(functx:all-whitespace($doc//tei:sourceDesc/tei:listWit))) then transform:transform($doc//tei:sourceDesc/tei:listWit, doc(concat($config:xsl-collection-path, '/sourceDesc.xsl')), config:get-xsl-params(()))
else if(not(functx:all-whitespace($doc//tei:sourceDesc/tei:msDesc))) then transform:transform($doc//tei:sourceDesc/tei:msDesc, doc(concat($config:xsl-collection-path, '/sourceDesc.xsl')), config:get-xsl-params(()))
else if(not(functx:all-whitespace($doc//tei:sourceDesc/tei:biblStruct))) then bibl:printCitation($doc//tei:sourceDesc/tei:biblStruct, 'p', $lang)
else (<span class="noDataFound">{lang:get-language-string('noDataFound',$lang)}</span>)
let $source := $doc//tei:sourceDesc/tei:*[name(.) != 'correspDesc']
return
if(functx:all-whitespace($source)) then
<span class="noDataFound">{lang:get-language-string('noDataFound',$lang)}</span>
else
typeswitch($source)
case element(tei:listWit) return wega:listWit($source, $lang)
case element(tei:msDesc) return transform:transform($source, doc(concat($config:xsl-collection-path, '/sourceDesc.xsl')), config:get-xsl-params(()))
case element(tei:biblStruct) return bibl:printCitation($source, 'p', $lang)
default return <span class="noDataFound">{lang:get-language-string('noDataFound',$lang)}</span>
}</div>
{if(exists($doc//tei:creation)) then (
<h3>{lang:get-language-string('creation',$lang)}</h3>,
Expand All @@ -1357,6 +1363,21 @@ declare function wega:printSourceDesc($doc as document-node(), $lang as xs:strin
</div>
};

declare %private function wega:listWit($listWit as element(tei:listWit), $lang as xs:string) {
for $witness at $count in $listWit/tei:witness
let $source := $witness/tei:*
order by $witness/@n ascending
return
<div class="witness" id="{concat('source_', $count)}">{
if($count ne 1) then attribute style {'display:none;'} else (),
typeswitch($source)
case element(tei:bibl) return core:normalize-space($source)
case element(tei:msDesc) return transform:transform($source, doc(concat($config:xsl-collection-path, '/sourceDesc.xsl')), config:get-xsl-params(()))
case element(tei:biblStruct) return bibl:printCitation($source, 'p', $lang)
default return <span class="noDataFound">{lang:get-language-string('noDataFound',$lang)}</span>
}</div>
};

(:~
: Get resources from the web by PND and store the result in a cache object with the current date.
: If the date does match with today's date then the result will be taken from the cache; otherwise the external resource will be queried.
Expand Down

0 comments on commit 435877e

Please sign in to comment.