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
81003c5e
Commit
81003c5e
authored
Jun 30, 2018
by
Mathias Goebel
🎠
Browse files
generic bibl; resolve xml:id, closes
#31
parent
50f6b5bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/fontane/register.xqm
View file @
81003c5e
...
...
@@ -21,6 +21,7 @@ declare variable $f-register:getIndex := request:get-parameter('i', '');
declare variable $f-register:getNotebook := $f-register:targetStart || request:get-parameter('nb', '');
declare variable $f-register:dataPath := '/db/sade-projects/textgrid/data/xml/data/';
declare variable $f-register:dataCollection := collection($f-register:dataPath);
(:~
: helper function to get the tgmd:title by URI
...
...
@@ -41,7 +42,7 @@ as xs:string {
: :)
declare function local:check-active($id as xs:string, $node as element(*)+)
as xs:boolean {
$node//@xml:id =
$id
exists($node/id(
$id
))
};
(:~
...
...
@@ -90,7 +91,7 @@ if(not(exists($variant))) then () else
};
(:~
: transform tei:idno to xhtml:li
: transform
s
tei:idno to xhtml:li
: @param $idnos – tei element (idno and label) with reference to authority file
: TODO: declare element(tei:idno), currently wrong encoding with tei:label
: :)
...
...
@@ -146,7 +147,7 @@ element xhtml:li {
element xhtml:li {
element xhtml:a {
attribute href { "?e=" || string-join($target) },
$
target
$
f-register:dataCollection/id($target)/*[1]/string()
}
}
}
...
...
@@ -251,7 +252,8 @@ declare function local:pointer($entry as element())
as element(xhtml:li) {
let $labelMain := ($entry/*)[1]
let $target := $entry/tei:note/tei:ptr/@target => substring-after('#')
let $targetNode := $entry/root()//@xml:id[. = $target]/parent::tei:*
let $targetNode := $f-register:dataCollection/id($target)
let $console := if($targetNode[2]) then console:log($targetNode[2]) else ()
return
element xhtml:li {
attribute class {
...
...
@@ -270,12 +272,39 @@ as element(xhtml:li) {
"siehe: ",
element xhtml:a {
attribute href { "?e=" || $target },
string($targetNode/*[1])
try {
string($targetNode/*[1])
} catch * {
(: TOD remove try catch when the data is better :)
console:log($targetNode),
"multiple entities found: " || string-join(($targetNode ! serialize(.)), " AND ")
}
}
}
}
}
};
declare function local:bibl($bibls as element(tei:bibl)*)
as element(xhtml:li)* {
for $bibl in $bibls
let $biblId := $bibl/tei:ptr/@target => substring-after(":")
let $targetNode := $f-register:dataCollection/id($biblId)[. instance of element(tei:bibl)]
return
element xhtml:li {
attribute class { "bibl" },
element xhtml:a {
attribute href { "literaturvz.html?id=" || $biblId },
<xhtml:i class="fa fa-book" aria-hidden="true"></xhtml:i>,
" ",
$targetNode/*[1]/string() ||
(if($bibl/tei:citedRange)
then ": " || $bibl/tei:citedRange
else ())
}
}
};
(:~
: Main function to create a complete index, contains some template specific
: code.
...
...
@@ -445,18 +474,7 @@ return
}
},
(: bibl :)
if(not(exists($bibl))) then () else
let $biblId := $bibl/tei:ptr/@target => substring-after(":")
return
element xhtml:li {
attribute class { "bibl" },
element xhtml:a {
attribute href { "literaturvz.html?id=" || $biblId },
<xhtml:i class="fa fa-book" aria-hidden="true"></xhtml:i>,
" ",
$biblId
}
},
local:bibl($bibl),
(: links :)
local:links($links),
local:li-code($event)
...
...
@@ -531,18 +549,7 @@ return
(: note :)
local:note($note),
(: bibl :)
if(not(exists($bibl))) then () else
let $biblId := $bibl/tei:ptr/@target => substring-after(":")
return
element xhtml:li {
attribute class { "bibl" },
element xhtml:a {
attribute href { "literaturvz.html?id=" || $biblId },
<xhtml:i class="fa fa-book" aria-hidden="true"></xhtml:i>,
" ",
$biblId
}
},
local:bibl($bibl),
(: links :)
local:links($links),
local:li-code($org)
...
...
@@ -670,7 +677,7 @@ else
attribute href { "?e=" || $memberId },
<xhtml:i class="fa fa-user" aria-hidden="true"></xhtml:i>,
" ",
$
memberId
$
f-register:dataCollection/id($memberId)/*[1]/string()
}
}
}
...
...
@@ -680,21 +687,7 @@ else
(: note :)
local:note($note),
(: bibl :)
for $b in $bibl
let $biblId := $b/tei:ptr/@target => substring-after(":")
return
element xhtml:li {
attribute class { "bibl" },
element xhtml:a {
attribute href { "literaturvz.html?id=" || $biblId },
<xhtml:i class="fa fa-book" aria-hidden="true"></xhtml:i>,
" ",
$biblId ||
(if($b/tei:citedRange)
then ": " || $b/tei:citedRange
else ())
}
},
local:bibl($bibl),
(: links :)
local:links($links),
local:li-code($pers)
...
...
@@ -785,21 +778,7 @@ else
(: note :)
local:note($note),
(: bibl :)
for $b in $bibl
let $biblId := $b/tei:ptr/@target => substring-after(":")
return
element xhtml:li {
attribute class { "bibl" },
element xhtml:a {
attribute href { "literaturvz.html?id=" || $biblId },
<xhtml:i class="fa fa-book" aria-hidden="true"></xhtml:i>,
" ",
$biblId ||
(if($b/tei:citedRange)
then ": " || $b/tei:citedRange
else ())
}
},
local:bibl($bibl),
(: events took place :)
for $l in $tookPlaceAt
let $id := $l/@target => substring-after(":") => substring-before(" ")
...
...
@@ -810,7 +789,7 @@ else
attribute href { "?e=" || $id },
<xhtml:i class="fa fa-bolt" aria-hidden="true"></xhtml:i>,
" ",
$
id
$
f-register:dataCollection/id($id)/*[1]/string()
}
},
(: former_or_current_location :)
...
...
@@ -823,7 +802,7 @@ else
attribute href { "?e=" || $id },
<xhtml:i class="fa fa-map-marker" aria-hidden="true"></xhtml:i>,
" ",
$
id
$
f-register:dataCollection/id($id)/*[1]/string()
}
},
(: links :)
...
...
@@ -937,21 +916,7 @@ else
(: note :)
local:note($note),
(: bibl :)
for $b in $bibl
let $biblId := $b/tei:ptr/@target => substring-after(":")
return
element xhtml:li {
attribute class { "bibl" },
element xhtml:a {
attribute href { "literaturvz.html?id=" || $biblId },
<xhtml:i class="fa fa-book" aria-hidden="true"></xhtml:i>,
" ",
$biblId ||
(if($b/tei:citedRange)
then ": " || $b/tei:citedRange
else ())
}
},
local:bibl($bibl),
(: links :)
local:links($links),
local:li-code($work),
...
...
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