Commit 8e21888e authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

copy GND file, set link to wikipedia when available.

parent 1c305751
......@@ -12,6 +12,7 @@ module namespace f-indexproc="http://fontane-nb.dariah.eu/indexproc";
import module namespace f-misc="http://fontane-nb.dariah.eu/ns/SADE/misc" at "misc.xqm";
import module namespace code="http://bdn-edition.de/ns/code-view";
declare namespace foaf="http://xmlns.com/foaf/0.1/";
declare namespace gndo="http://d-nb.info/standards/elementset/gnd#";
declare namespace ore="http://www.openarchives.org/ore/terms/";
declare namespace rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
......@@ -224,6 +225,7 @@ declare function local:idno($idnos as element()*)
as element(xhtml:li)* {
for $idno in $idnos
let $str := string($idno)
let $wikipedia := if($idno/@type = "GND") then local:gnd-wikipedia($str) else ()
return
element xhtml:li {
attribute class {"idno"},
......@@ -254,10 +256,36 @@ return
then "NDB"
else "DB"
})
else ()
else (),
if($wikipedia = "") then ()
else (", ",
element xhtml:a {
attribute title {"Link zu Wikipedia basierend auf GND"},
attribute href { $wikipedia },
<i class="fa fa-wikipedia-w" aria-hidden="true"></i>
})
}
};
declare function local:gnd-wikipedia($gndid-orig as xs:string)
as xs:string?{
let $gndid := replace($gndid-orig, "[^A-Za-z0-9\-]", "+")
let $gndCollection := "/db/sade-projects/textgrid/data/xml/gnd/"
let $filename := $gndid || ".xml"
let $docname := $gndCollection || $filename
let $url := "https://d-nb.info/gnd/" || $gndid || "/about/lds.rdf"
let $persist := false()
let $request-headers := ()
let $response :=
if( doc-available( $docname ))
then doc( $docname )
else
httpclient:get(xs:anyURI($url), $persist, $request-headers)
let $store := xmldb:store($gndCollection, $filename, $response)
return
string($response//foaf:page/@rdf:resource)
};
(:~
: transformation from tei:note to xhtml:li
: :)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment