Commit 1f5929eb authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

Merge branch 'develop' of gitlab.gwdg.de:fontane-notizbuecher/SADE into develop

parents 06583b50 142bd54b
......@@ -3,7 +3,7 @@ xquery version "3.1";
(:~
: This module is responsible for getting an XML version of the abbreviations
: index which can be converted to TeX. This XML version is appended to
: fontane-full.xml during the creation of the intermediate format in etTransfo.xmq.
: fontane-full.xml during the creation of the intermediate format in etTransfo.xqm.
:
: @author Michelle Weidling
: @version 0.1
......@@ -25,6 +25,7 @@ declare function abbrev-index:main() as element(tei:div) {
let $transformed :=
abbrev-index:transform($file)
=> abbrev-index:tidy()
=> abbrev-index:sort()
return
element tei:div {
......@@ -132,3 +133,51 @@ declare function abbrev-index:tidy($nodes as node()*) as node()* {
else
()
};
declare function abbrev-index:sort($nodes as node()*) as node()* {
for $node in $nodes return
typeswitch ($node)
case text() return
$node
case element(tei:row) return
let $first-char :=
normalize-space($node/tei:cell[1]/text())
=> substring(1, 1)
=> upper-case()
let $prev-first-char :=
normalize-space($node/preceding-sibling::tei:row[1]/tei:cell[1]/text())
=> substring(1, 1)
=> upper-case()
let $current-row :=
element {QName("http://www.tei-c.org/ns/1.0", $node/local-name())} {
$node/@*,
abbrev-index:sort($node/node())
}
return
if($node[@role = "head"]) then
$current-row
else if(not($first-char = $prev-first-char)
or not($node/preceding-sibling::tei:row[1])
or $node/preceding-sibling::tei:row[1][@role = "head"]) then
(
element {QName("http://www.tei-c.org/ns/1.0", $node/local-name())} {
element tei:cell {
attribute type {"lemma"},
$first-char
},
element tei:cell {}
},
$current-row
)
else
$current-row
default return
element {QName("http://www.tei-c.org/ns/1.0", $node/local-name())} {
$node/@*,
abbrev-index:sort($node/node())
}
};
......@@ -22,9 +22,7 @@ import module namespace config="http://textgrid.de/ns/SADE/config" at "../../con
import module namespace fontaneSimple="http://fontane-nb.dariah.eu/teisimple" at "tei2teisimple.xqm";
import module namespace fsort="http://fontane-nb.dariah.eu/sort" at "sort.xqm";
import module namespace functx = "http://www.functx.com";
import module namespace macro-sort="http://fontane-nb.dariah.eu/macro-sort" at "macro-sort.xqm";
import module namespace prepCom="http://fontane-nb.dariah.eu/prepCom" at "prepcom.xqm";
import module namespace presort="http://fontane-nb.dariah.eu/presort" at "presort.xqm";
import module namespace simple2xhtml="http://fontane-nb.dariah.eu/simple2xhtml" at "simple2xhtml.xqm";
import module namespace tidySimple ="http://fontane-nb.dariah.eu/tidysimple" at "tidysimple.xqm";
......@@ -192,18 +190,9 @@ declare function etTransfo:create-htmls($showcase as xs:string) as xs:string* {
: @param $tei The current notebook as element(tei:TEI)
:)
declare function etTransfo:transform-tei($tei as element(tei:TEI), $log as xs:string) {
(: macro-sort:main($tei, $tei/@id):)
(: let $macro-sorted :=:)
(: try {:)
(: macro-sort:main($tei, $tei/@id):)
(: } catch * {:)
(: etTransfo:add-log-entry($log, "ETTRANSFO14: Error while macro sorting this notebook. Reason: 
" ||:)
(: concat("[", $err:line-number, ": ", $err:column-number, "] Error ", $err:code, ": ", $err:description)):)
(: }:)
let $sorted :=
try {
fsort:main($tei, $log)
(: fsort:main($macro-sorted, $log) :)
} catch * {
etTransfo:add-log-entry($log, "ETTRANSFO09: Error while sorting this notebook. Reason: 
" ||
concat("[", $err:line-number, ": ", $err:column-number, "] Error ", $err:code, ": ", $err:description))
......@@ -266,6 +255,12 @@ declare function etTransfo:create-print-tei() as xs:string {
abbrev-index:main()
} catch * {
etTransfo:add-log-entry($log, "ETTRANSFO07: An error occured while creating the index of abbreviations.")
},
try {
etTransfo:create-overall-toc()
} catch * {
etTransfo:add-log-entry($log, "ETTRANSFO10: An error occured while creating the overall TOC..")
}
}
return
......@@ -484,3 +479,48 @@ declare function etTransfo:report-errors() as item()* {
util:log-system-out("Total: " || count(xmldb:get-child-resources($log-path)) || " notebook(s).")
)
};
(:~
: creates the overall TOC by collection information from all Überblickskommentare.
: this info is needed for a separate kind of index in the book.
:
: TODO: fine tuning
:
: @author Michelle Weidling:)
declare function etTransfo:create-overall-toc() as element(tei:div) {
let $nbs := collection($config:data-root || "/data")
let $items := collection($config:data-root || "/data")//tei:TEI[descendant::tei:title = "Notizbuch E1"]/tei:teiHeader//tei:msContents/tei:ab/tei:list[@type="editorial"]/tei:item
let $sortPattern := "^\W+"
return element tei:div {
attribute type {"overall-toc"},
let $segs :=
for $doc in $nbs
return
let $nb-name := $doc//tei:fileDesc/tei:titleStmt/tei:title[1]/substring-after(., " ")
return
for $item in $doc//tei:msContents/tei:ab/tei:list[@type="editorial"]//tei:item return
let $first-ref := $item//tei:ref[@type = "first"]/@target/string()
let $last-ref := $item//tei:ref[@type = "last"]/@target/string()
let $refs :=
for $ref in ($first-ref, $last-ref) return
let $tokens := tokenize($ref, " ")
return $tokens[2]
return
element tei:seg {
attribute type {$nb-name},
attribute source {
let $string := for $ref in $refs return
substring-after($ref, "@xml:id='")
=> substring-before("']")
return
string-join($string, " ")
},
normalize-space(functx:substring-before-last($item, ")") || ")")
}
return for $seg in $segs
order by replace($seg, $sortPattern, "") => substring(1, 1) => upper-case()
return $seg
}
};
xquery version "3.1";
module namespace macro-sort="http://fontane-nb.dariah.eu/macro-sort";
import module namespace config="http://textgrid.de/ns/SADE/config" at "../../config/config.xqm";
declare namespace tei="http://www.tei-c.org/ns/1.0";
declare namespace xi="http://www.w3.org/2001/XInclude";
declare function macro-sort:main($tei as node()*, $uri as xs:string) as node()* {
let $header := $tei//tei:teiHeader
let $sorted := macro-sort:sort($tei//tei:sourceDoc)
(: let $cleared := macro-sort:clear($sorted):)
let $cleared := $sorted
let $final-tei :=
element tei:TEI {
$header,
$cleared
}
let $store := xmldb:store($config:data-root || "/print/xml/", $uri || "-macrosort.xml", $final-tei)
return
$final-tei
};
declare function macro-sort:sort($nodes as node()*) as node()* {
for $node in $nodes return
typeswitch ($node)
case text() return
$node
case comment() return
$node
case element(tei:milestone) return
if($node/@unit = "section") then
let $end-point-id := replace($node/@spanTo, "#", "")
let $end-point := $node/root()//tei:anchor[@xml:id = $end-point-id]
let $number := substring-after($node/@type, "Text_")
let $handshift := $node/preceding::tei:milestone[@unit = "handshift"][1]
return
element tei:div {
attribute n {$number},
(: $node/(@* except @spanTo),:)
$node/@*,
$handshift,
(: all nodes on the current surface :)
$node/following-sibling::node()[. << $end-point],
$node/../following-sibling::node()[. << $end-point],
(: all complete surfaces before the anchor :)
$node/ancestor::tei:surface/following-sibling::tei:surface[. << $end-point],
(: all elements on the surface that contains the anchor which are before the anchor :)
$node/ancestor::tei:surface/following-sibling::tei:surface[descendant::tei:anchor[@xml:id = $end-point-id]]//tei:anchor[@xml:id = $end-point-id]/preceding-sibling::*
}
else
macro-sort:copy-element($node)
default return
let $section-marker := $node/preceding::tei:milestone[@unit = "section"][1]
let $end-point-id := replace($section-marker/@spanTo, "#", "")
let $end-point := $node/root()//tei:anchor[@xml:id = $end-point-id]
return
if($node[. >> $section-marker and . << $end-point]) then
()
else
macro-sort:copy-element($node)
};
declare function macro-sort:copy-element($node as element(*)) as element(*) {
element {QName("http://www.tei-c.org/ns/1.0", $node/name())} {
$node/@*,
macro-sort:sort($node/node())
}
};
declare function macro-sort:clear($nodes as node()*) as node()* {
for $node in $nodes return
typeswitch ($node)
case text() return
$node
case comment() return
$node
default return
if($node/@outside-section = "true") then
()
else
$node
};
......@@ -6,20 +6,15 @@ xquery version "3.1";
: is referenced by an editorial commentary (tei:note[@type = 'editorial']).
:
: @author Michelle Weidling
: @version 1.0
: @version 1.1
:)
module namespace prepCom="http://fontane-nb.dariah.eu/prepCom";
declare namespace tei="http://www.tei-c.org/ns/1.0";
declare namespace xi="http://www.w3.org/2001/XInclude";
import module namespace config="http://textgrid.de/ns/SADE/config" at "../../config/config.xqm";
import module namespace fontaneSimple="http://fontane-nb.dariah.eu/teisimple" at "tei2teisimple.xqm";
import module namespace functx = "http://www.functx.com";
import module namespace presort="http://fontane-nb.dariah.eu/presort" at "presort.xqm";
import module namespace simple2xhtml="http://fontane-nb.dariah.eu/simple2xhtml" at "simple2xhtml.xqm";
import module namespace tidySimple ="http://fontane-nb.dariah.eu/tidysimple" at "tidysimple.xqm";
declare variable $prepCom:literature :=
map:merge(for $entry in doc("/db/sade-projects/textgrid/data/xml/data/25547.xml")//tei:bibl
......@@ -35,7 +30,8 @@ declare variable $prepCom:literature :=
: @param $id The notebook's ID, e.g. "16b00"
: @return The current notebook with prepared editorial commentaries
:)
declare function prepCom:main($tei as node()*, $id as xs:string) {
declare function prepCom:main($tei as node()*, $id as xs:string)
as element(tei:TEI){
let $add-ptr := prepCom:recursion($tei)
let $prepared := prepCom:find-literature($add-ptr)
let $store := xmldb:store($config:data-root || "/print/xml/", $id || "-prepcom.xml", $prepared)
......@@ -158,7 +154,7 @@ as element(tei:seg) {
let $label-elements :=
for $id in $corresp-ids
let $id := substring-after($id, "#")
return $node/ancestor::tei:TEI//*[@xml:id = $id]
return $node/root()//*[@xml:id = $id]
return
if($no-of-elements = 1) then
prepCom:create-label-text($label-elements)
......@@ -188,7 +184,7 @@ as element(tei:seg) {
: @return The complete label text
:)
declare function prepCom:create-label-text($node as node()) as xs:string {
string-join($node/descendant::text(), " ")
string-join($node/descendant::text()[not(parent::tei:expan)], "")
=> replace("- |⸗ ", "")
};
......
xquery version "3.1";
module namespace presort="http://fontane-nb.dariah.eu/presort";
declare namespace tei="http://www.tei-c.org/ns/1.0";
declare namespace test="http://exist-db.org/xquery/xqsuite";
import module namespace functx="http://www.functx.com";
import module namespace simpleHelpers="http://fontane-nb.dariah.eu/teisimplehelpers" at "teisimplehelpers.xqm";
(:~
: Marks all nodes that are part of an interlinear addition.
:
: @author Michelle Weidling
: @param $node The current node
: @return The processed node
:)
declare function presort:prepare($nodes as node()*) as node()* {
for $node in $nodes
return
typeswitch ($node)
case text() return
$node
case comment() return
if(matches($node/string(), "rotate")) then
$node
else
()
default return
if($node/preceding-sibling::*[self::tei:addSpan][1][@place = 'interlinear'][@prev or @next]
and not($node[self::tei:anchor])) then
presort:mark-interlinear-node-to-be-moved($node)
else
element {QName("http://www.tei-c.org/ns/1.0", $node/name())} {
$node/@*,
presort:prepare($node/node())
}
};
(:~
: Interlinear additions can be part of a virtual aggregation. Since their
: start is marked by tei:addSpan and their end by tei:anchor, all nodes inbetween
: have to be moved when the right chronology is established, too. To make this
: easier, the respective nodes are marked with an attribute.
:
: All other nodes are simply copied.
:
: @author Michelle Weidling
: @param $node The current node
: @return The processed node
:)
declare function presort:mark-interlinear-node-to-be-moved($node as element())
as element() {
let $addSpan := $node/preceding-sibling::*[self::tei:addSpan][1][@place = 'interlinear'][@prev or @next]
let $spanTo := substring-after($addSpan/@spanTo, "#")
let $anchor := $addSpan/following::tei:anchor[@xml:id = $spanTo]
let $nodes-inbetween := $addSpan/following-sibling::*[. << $anchor]
return
element {QName("http://www.tei-c.org/ns/1.0", $node/name())} {
$node/@*,
if(functx:is-node-in-sequence-deep-equal($node, $nodes-inbetween)) then
attribute type {"interlinear"}
else
(),
$node/node()
}
};
(:~
: Creates a new encoding structure for tei:metamark[@function = "integrate"]
: that makes further processing of them easier. All nodes relevant for the
: integration brackets are summarized in a tei:seg[@type = 'integration'].
:
: @author Michelle Weidling
: @param $node The current node
: @return The processed node
:)
declare function presort:sort-integrations($nodes as node()*) as node()* {
for $node in $nodes return
if($node/@xml:id) then
let $id := $node/@xml:id
let $metamarks := $node/ancestor::*[last()]//tei:metamark[@function = "integrate"]
let $linking-node-corresp := $metamarks[substring-after(@corresp, "#") = $id]
let $linking-node-target := $metamarks[substring-after(@target, "#") = $id]
return
if($linking-node-corresp and not($linking-node-target)) then
let $integration-target-id := replace($linking-node-corresp/@target, "#", "")
let $integration-comment := $linking-node-corresp/ancestor::*[last()]//*[@xml:id = $integration-target-id]
return
element tei:seg {
attribute type {"integration"},
$integration-comment,
$linking-node-corresp,
presort:keep-node-integrations($node)
}
else if($linking-node-target) then
()
else
presort:keep-node-integrations($node)
else if($node[self::tei:metamark[@function = "integrate"]]) then
()
else if($node[self::text() or self::comment()]) then
$node
else
presort:keep-node-integrations($node)
};
(:~
: An auxiliary function that copies a given node while sorting the integrations.
:
: @author Michelle Weidling
: @param $node The current node
: @return A copy of the given node
:)
declare function presort:keep-node-integrations($node as node()) as node()* {
element {QName("http://www.tei-c.org/ns/1.0", $node/name())} {
$node/@*,
(: $node/(@* except (@prev, @next)), (: attrs only visible for debugging :):)
presort:sort-integrations($node/node())
}
};
This diff is collapsed.
......@@ -84,10 +84,21 @@ declare function simpleHelpers:prepare-text($node as text()) as text()? {
(: and $node/parent::tei:add) then:)
(: $node:)
(: else :)
if(ends-with($node, "-") and not(simpleHelpers:keep-hyphen($node))) then
text {functx:substring-before-last($node, "-") || "@P"}
else if(ends-with($node, "⸗") and not(simpleHelpers:keep-hyphen($node))) then
text {functx:substring-before-last($node, "⸗") || "@P"}
if(ends-with($node, "-")
and
($node/ancestor::tei:line//text()[not(normalize-space(.) = "")][last()] = $node
or $node/ancestor::tei:rs[@next]//text()[last()] = $node
or $node/ancestor::*/following-sibling::tei:milestone[@unit = "line"])
and not(simpleHelpers:keep-hyphen($node))) then
text {functx:substring-before-last($node, "-") || "@P"}
else if(ends-with($node, "⸗")
and
($node/ancestor::tei:line//text()[not(normalize-space(.) = "")][last()] = $node
or $node/ancestor::tei:rs[@next]//text()[last()] = $node
or $node/ancestor::*/following-sibling::tei:milestone[@unit = "line"])
and not(simpleHelpers:keep-hyphen($node))) then
text {functx:substring-before-last($node, "⸗") || "@P"}
else
replace($node, "⸗", "-")
let $save-whitespaces := replace($cleared-end-hyphen, " ", "@@")
......@@ -103,7 +114,8 @@ declare function simpleHelpers:prepare-text($node as text()) as text()? {
else
$cleared-round-s
let $escaped-big-space := text{replace($cleared-big-space, "&#x2003;", "?@?")}
let $cleared-Tironian := replace($cleared-big-space, "&#x204a;c.", "etc.")
let $escaped-dito := text{replace($escaped-big-space, "&#12291;", "?@@?")}
let $cleared-Tironian := replace($escaped-dito, "&#x204a;c.", "etc.")
return
(: in cases where a given $node only consists of a hyphen we don't
return a text node because it's unnecessary and leads to problems
......@@ -298,8 +310,8 @@ declare function simpleHelpers:is-hand-valid($hands as xs:string*,
$node as element(tei:milestone)) as xs:boolean {
let $current-hand := replace($node/@subtype, "#", "")
return
if(functx:is-value-in-sequence($current-hand, $hands)
or ($node/ancestor::*[@type = ("label", "toc", "Kalenderblatt")]
if($node/root()//tei:handNote[@xml:id = $current-hand]/@script = "contemporary"
or ($node/ancestor::*[@type = ("label", "toc")]
and matches($current-hand, "Friedrich_Fontane"))
) then
true()
......@@ -382,17 +394,6 @@ as xs:boolean {
false()
};
(: TODO :)
(:declare function simpleHelpers:make-section($node as element(tei:milestone))
as element(tei:section) {
let $id := substring-after($node/@spanTo, "#")
let $corresp := $node/following::*[$id = @xml:id]
let $bla := console:log(util:get-fragment-between($node, $corresp, true(), true()))
return
<div/>
};:)
declare function simpleHelpers:find-chars($node as element(tei:lb)) as node()* {
let $prev-line := $node/preceding::tei:line[1]
let $prev-last-text := $prev-line/text()[last()]
......
xquery version "3.1";
(: This main module starts the tests stored in teisimple-test.xql. :)
import module namespace presort-test = "http://fontane-nb.dariah.eu/presort-test" at "presort-test.xq";
import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql";
declare namespace tei="http://www.tei-c.org/ns/1.0";
test:suite(
util:list-functions("http://fontane-nb.dariah.eu/presort-test")
)
xquery version "3.1";
(: This library module contains XQSuite tests for the presorting module stored
: in ../presort.xqm :)
module namespace presort-test = "http://fontane-nb.dariah.eu/presort-test";
import module namespace presort="http://fontane-nb.dariah.eu/presort" at "../presort.xqm";
declare namespace tei="http://www.tei-c.org/ns/1.0";
declare namespace test="http://exist-db.org/xquery/xqsuite";
(: Text :)
declare
%test:name("Text nodes")
%test:args("Just some text")
%test:assertEquals("Just some text")
%test:args("Text with Ümläöuts")
%test:assertEquals("Text with Ümläöuts")
%test:args("Hiſtoriſches ✓")
%test:assertEquals("Hiſtoriſches ✓")
function presort-test:text($node as text()) {
presort:sort($node)
};
(: Default nodes :)
declare
%test:name("Default nodes")
%test:args("<handShift xmlns:tei=""http://www.tei-c.org/ns/1.0"" medium=""pencil"" script=""Latf""/>")
%test:assertEquals("<handShift xmlns:tei=""http://www.tei-c.org/ns/1.0"" medium=""pencil"" script=""Latf""/>")
%test:args("<seg xmlns:tei=""http://www.tei-c.org/ns/1.0""><stamp xmlns:tei=""http://www.tei-c.org/ns/1.0"">STAATSBIBLIOTHEK •BERLIN•</stamp></seg>")
%test:assertEquals("<seg xmlns:tei=""http://www.tei-c.org/ns/1.0""><stamp xmlns:tei=""http://www.tei-c.org/ns/1.0"">STAATSBIBLIOTHEK •BERLIN•</stamp></seg>")
function presort-test:default-nodes($node as element(*)) {
presort:sort($node)
};
(: @next nodes :)
declare
%test:name("Establishing right order with @next nodes")
(: case 1: two elements referencing each other also stand right next to each
other, i.e. there's no text inbetween. then nothing should happen :)
%test:args("<text xmlns:tei=""http://www.tei-c.org/ns/1.0""><zone xmlns:tei=""http://www.tei-c.org/ns/1.0"" type=""item""><line>in das <rs next=""#C07_1r_b"" ref=""plc:Kloster_EF"" xml:id=""C07_1r_a"" type=""direct"">Auguſtinerkloſter</rs></line><line><rs ref=""plc:Kloster_EF"" prev=""#C07_1r_a"" xml:id=""C07_1r_b"" type=""direct"">zu Erfurt</rs></line></zone></text>")
%test:assertEquals("<text xmlns:tei=""http://www.tei-c.org/ns/1.0""><zone xmlns:tei=""http://www.tei-c.org/ns/1.0"" type=""item""><line>in das <rs next=""#C07_1r_b"" ref=""plc:Kloster_EF"" xml:id=""C07_1r_a"" type=""direct"">Auguſtinerkloſter</rs></line><line><rs ref=""plc:Kloster_EF"" prev=""#C07_1r_a"" xml:id=""C07_1r_b"" type=""direct"">zu Erfurt</rs></line></zone></text>")
(: case 2: two elements referencing each other are seperated by an arbitrary
amout of text. then they should be sorted into the right order :)
%test:args("<text xmlns:tei=""http://www.tei-c.org/ns/1.0""><zone><line next=""#C07_1r_13"" xml:id=""C07_1r_q"">2. Luther, <hi>Eisleben</hi><date when-iso=""1483"" type=""asynchronous"">1483</date></line><line>Some Text</line></zone><zone prev=""#C07_1r_q"" type=""item"" xml:id=""C07_1r_13""><handShift medium=""brown_ink thin_pen""/><line>Ein Stück ſeines Mantels und ſei</line></zone></text>")
%test:assertEquals("<text xmlns:tei=""http://www.tei-c.org/ns/1.0""><zone><line next=""#C07_1r_13"" xml:id=""C07_1r_q"">2. Luther, <hi>Eisleben</hi><date when-iso=""1483"" type=""asynchronous"">1483</date></line><zone prev=""#C07_1r_q"" type=""item"" xml:id=""C07_1r_13""><handShift medium=""brown_ink thin_pen""/><line>Ein Stück ſeines Mantels und ſei</line></zone><line>Some Text</line></zone></text>")
function presort-test:next-nodes($node as element(*)) {
presort:sort($node)
};
(: @prev nodes :)
declare
%test:name("Omit @prev nodes")
%test:args("<handShift xmlns:tei=""http://www.tei-c.org/ns/1.0"" medium=""pencil"" script=""Latf""/>")
%test:assertEquals("<handShift xmlns:tei=""http://www.tei-c.org/ns/1.0"" medium=""pencil"" script=""Latf""/>")
%test:args("<text xmlns:tei=""http://www.tei-c.org/ns/1.0""><seg xml:id=""some_id"" next=""#id""/><seg xml:id=""id"" prev=""#some_id""><stamp xmlns:tei=""http://www.tei-c.org/ns/1.0"">STAATSBIBLIOTHEK •BERLIN•</stamp></seg></text>")
%test:assertEquals("<text xmlns:tei=""http://www.tei-c.org/ns/1.0""><seg xml:id=""some_id"" next=""#id""/><seg xml:id=""id"" prev=""#some_id""><stamp xmlns:tei=""http://www.tei-c.org/ns/1.0"">STAATSBIBLIOTHEK •BERLIN•</stamp></seg></text>")
%test:args("<seg xmlns:tei=""http://www.tei-c.org/ns/1.0"" prev=""#some_id"" next=""#some_other_id""><stamp xmlns:tei=""http://www.tei-c.org/ns/1.0"">STAATSBIBLIOTHEK •BERLIN•</stamp></seg>")
%test:assertEquals("<seg xmlns:tei=""http://www.tei-c.org/ns/1.0"" prev=""#some_id"" next=""#some_other_id""><stamp xmlns:tei=""http://www.tei-c.org/ns/1.0"">STAATSBIBLIOTHEK •BERLIN•</stamp></seg>")
%test:args("<text xmlns:tei=""http://www.tei-c.org/ns/1.0""><seg xml:id=""some_id"" next=""#id""/><seg xmlns:tei=""http://www.tei-c.org/ns/1.0"" xml:id=""id"" prev=""#some_id"" next=""#some_other_id""><stamp prev=""#id"" xmlns:tei=""http://www.tei-c.org/ns/1.0"">STAATSBIBLIOTHEK •BERLIN•</stamp></seg><seg xml:id=""some_other_id""/></text>")
%test:assertEquals("<text xmlns:tei=""http://www.tei-c.org/ns/1.0""><seg xml:id=""some_id"" next=""#id""/><seg xmlns:tei=""http://www.tei-c.org/ns/1.0"" xml:id=""id"" prev=""#some_id"" next=""#some_other_id""><stamp prev=""#id"" xmlns:tei=""http://www.tei-c.org/ns/1.0"">STAATSBIBLIOTHEK •BERLIN•</stamp></seg><seg xml:id=""some_other_id""/></text>")
function presort-test:omit-prev-nodes($node as element(*)) {
presort:sort($node)
};
This diff is collapsed.
xquery version "3.1";
(:~
: This module handles the creation of the literature overview at
: literaturvz.html.
:
: @version 1.1
: @author Mathias Göbel
: @author Michelle Weidling
:)
module namespace fontaneLitVZ="http://fontane-nb.dariah.eu/LitVZ";
declare namespace tei="http://www.tei-c.org/ns/1.0";
......@@ -7,113 +19,172 @@ declare namespace xhtml="http://www.w3.org/1999/xhtml";
declare default element namespace "http://www.tei-c.org/ns/1.0";
declare function fontaneLitVZ:litvz(){
let $id := request:get-parameter('id', '')
let $doc := doc('/db/sade-projects/textgrid/data/xml/data/25547.xml')
let $tabs := <ul class="nav nav-tabs" style="font-size: smaller;">{
for $list at $pos in $doc//text/body/listBibl