Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
fontane-notizbuecher
SADE
Commits
8e21888e
Commit
8e21888e
authored
Aug 21, 2018
by
Mathias Goebel
🎠
Browse files
copy GND file, set link to wikipedia when available.
parent
1c305751
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
modules/fontane/index-processor.xqm
View file @
8e21888e
...
...
@@ -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
: :)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment