Commit 65c9076e authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

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

parents 82bf147c fdb09584
......@@ -19,7 +19,7 @@ declare namespace tei="http://www.tei-c.org/ns/1.0";
declare namespace xhtml="http://www.w3.org/1999/xhtml";
declare function abbrev-index:main() as node() {
declare function abbrev-index:main() as element(tei:div) {
let $docs-coll := collection("/db/sade-projects/textgrid/data/xml/doku/")
let $file := $docs-coll[matches(base-uri(.), "verzeichnis_der_abkuerzungen")]/*
let $transformed :=
......@@ -34,7 +34,7 @@ declare function abbrev-index:main() as node() {
};
(:~
: Handles the transformation to XML.
: Handles the transformation from XHTML to XML.
:
: @param $nodes The nodes currently processed
: @return The transformed nodes
......@@ -48,7 +48,11 @@ declare function abbrev-index:transform($nodes as node()*) as node()* {
or matches($node, "Gesamtdokumentation")) then
()
else
$node
text {
replace($node, "ſ", "s")
=> replace("m̄", "mm")
=> replace("n̄", "nn")
}
case element(xhtml:h2) return
()
......
......@@ -28,7 +28,7 @@ import module namespace tidySimple ="http://fontane-nb.dariah.eu/tidysimple" at
declare variable $etTransfo:cases :=
(
"3qtcz.xml", (: case C :)
(: "3qtcz.xml", (: case C :):)
"3qtqv.xml" (: case A :)
(: "3qtqw.xml" (: case B :) :)
(: "3qtqx.xml" (: case D :):)
......@@ -100,11 +100,11 @@ declare function etTransfo:create-case($showcase as xs:string) as xs:string {
error(QName("error", "ETTRANSFO04"), "Couldn't find the node tei:TEI of " || $uri || ".")
}
let $updated-notebook :=
element {QName("http://www.tei-c.org/ns/1.0", "TEI")} {
attribute id {$uri},
$tei-referred-to/@*,
$tei-referred-to/*
}
element tei:TEI {
attribute id {$uri},
$tei-referred-to/@*,
$tei-referred-to/*
}
return update replace $xi with $updated-notebook
return
......@@ -148,6 +148,13 @@ declare function etTransfo:create-htmls($showcase as xs:string) as xs:string+ {
etTransfo:transform-tei($tei)
};
(:~
: Handles the transformation to the intermediate format and the XHTML
: representation.
:
: @param $tei The current notebook as element(tei:TEI)
:)
declare function etTransfo:transform-tei($tei as element(tei:TEI)) {
fsort:main($tei)
=> prepCom:main($tei/@id)
......@@ -159,6 +166,7 @@ declare function etTransfo:transform-tei($tei as element(tei:TEI)) {
(:~
: Assembles the intermediate format version of each notebook and copies them into one file called "fontane-full.xml".
: Furthermore, additional data needed for the print is appended.
:
: @author Michelle Weidling
: @return A string indicating the location where the full TEI/XML of the edition was stored to.
......@@ -190,7 +198,7 @@ declare function etTransfo:create-print-tei() as xs:string {
: @author Michelle Weidling
: @return All available final intermediate format TEI/XML files as opened documents
:)
declare function etTransfo:get-all-xmls() {
declare function etTransfo:get-all-xmls() as node()+ {
for $res in collection($config:data-root || "/print/xml/")
[contains(base-uri(.), ".xml")
and not(contains(base-uri(.), "tmp"))
......@@ -217,52 +225,38 @@ declare function etTransfo:get-literature() as element(tei:div) {
element {QName("http://www.tei-c.org/ns/1.0", "text")} {
attribute type {"bibliography"},
element {QName("http://www.tei-c.org/ns/1.0", "div")} {
element tei:div {
attribute n {"Fontanes_Werke"},
element {QName("http://www.tei-c.org/ns/1.0", "div")} {
attribute n {"Erstausgaben"},
etTransfo:make-bib-entries("Erstausgaben")
},
element {QName("http://www.tei-c.org/ns/1.0", "div")} {
attribute n {"Werkausgaben"},
etTransfo:make-bib-entries("Werkausgaben")
},
element {QName("http://www.tei-c.org/ns/1.0", "div")} {
attribute n {"Briefausgaben"},
etTransfo:make-bib-entries("Briefausgaben")
},
element {QName("http://www.tei-c.org/ns/1.0", "div")} {
attribute n {"Postume_Einzelausgaben"},
etTransfo:make-bib-entries("Postume_Einzelausgaben")
},
element {QName("http://www.tei-c.org/ns/1.0", "div")} {
attribute n {"Populaere_postume_Einzelausgaben"},
etTransfo:make-bib-entries("Populaere_postume_Einzelausgaben")
}
},
element {QName("http://www.tei-c.org/ns/1.0", "div")} {
attribute n {"Fontanes_Quellen"},
etTransfo:make-bib-entries("Fontanes_Quellen")
},
element {QName("http://www.tei-c.org/ns/1.0", "div")} {
attribute n {"Allgemeine_Nachschlagewerke"},
etTransfo:make-bib-entries("Allgemeine_Nachschlagewerke")
local:make-bib-div("Erstausgaben"),
local:make-bib-div("Werkausgaben"),
local:make-bib-div("Briefausgaben"),
local:make-bib-div("Postume_Einzelausgaben"),
local:make-bib-div("Populaere_postume_Einzelausgaben")
},
local:make-bib-div("Fontanes_Quellen"),
local:make-bib-div("Allgemeine_Nachschlagewerke"),
local:make-bib-div("Nachschlagewerke_der_Fontane-Forschung"),
local:make-bib-div("Forschungsliteratur")
}
};
element {QName("http://www.tei-c.org/ns/1.0", "div")} {
attribute n {"Nachschlagewerke_der_Fontane-Forschung"},
etTransfo:make-bib-entries("Nachschlagewerke_der_Fontane-Forschung")
},
element {QName("http://www.tei-c.org/ns/1.0", "div")} {
attribute n {"Forschungsliteratur"},
etTransfo:make-bib-entries("Forschungsliteratur")
}
(:~
: An auxiliary function to create the tei:div elements in the bibliography.
:
: @author Michelle Weidling
: @param $identifier An identifier for a subtype of scholarly literature
: @return a tei:div containing all bibliographic information of the literatur's subtype
:)
declare function local:make-bib-div($identifier as xs:string) as element(tei:div) {
element tei:div {
attribute n {$identifier},
etTransfo:make-bib-entries($identifier)
}
};
(:~
: Creates a div containing all the scholarly literature ("Forschungsliteratur")
: of a kind that's listed in the respective index. Examples for this are
......@@ -284,14 +278,14 @@ declare function etTransfo:make-bib-entries($type as xs:string) as element(tei:d
let $bib-no := count($entry/ancestor::tei:bibl)
return
element {QName("http://www.tei-c.org/ns/1.0", "div")} {
element tei:div {
attribute type {"entry"},
element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
element tei:seg {
attribute type {"abbr"},
$abbr
},
if($full-ref) then
element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
element tei:seg {
attribute type {"full"},
$full-ref
}
......@@ -303,11 +297,11 @@ declare function etTransfo:make-bib-entries($type as xs:string) as element(tei:d
let $same-as-loc := $referenced-entry/ancestor::tei:listBibl[1]/@type/string()
return
(element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
(element tei:seg {
attribute type {"same-as"},
$same-as
},
element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
element tei:seg {
attribute type {"same-as-loc"},
$same-as-loc
})
......@@ -315,7 +309,7 @@ declare function etTransfo:make-bib-entries($type as xs:string) as element(tei:d
else
(),
if($bib-no gt 0) then
element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
element tei:seg {
attribute type {"sub-entry"},
$bib-no
}
......
......@@ -75,7 +75,7 @@ declare function prepCom:recursion($nodes as node()*) as node()* {
or contains($node, "Schlusslinie")) then
()
else
element {QName("http://www.tei-c.org/ns/1.0", "ptr")} {
element tei:ptr {
attribute type {"editorial-commentary"},
attribute subtype {"figure"}
},
......@@ -90,7 +90,7 @@ declare function prepCom:recursion($nodes as node()*) as node()* {
into several parts. in this case we only set the ptr when we have
the first lemma part :)
(if(prepCom:check-if-first-target-of-commentary($node)) then
(element {QName("http://www.tei-c.org/ns/1.0", "ptr")} {
(element tei:ptr {
attribute reference {$node/@xml:id},
attribute type {"editorial-commentary"}
},
......@@ -152,7 +152,7 @@ as element(tei:seg) {
let $corresp-ids := tokenize($note/@target, " ")
return
element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
element tei:seg {
attribute type {"editorial-label"},
let $no-of-elements := count($corresp-ids)
let $label-elements :=
......@@ -164,7 +164,7 @@ as element(tei:seg) {
prepCom:create-label-text($label-elements)
else if($no-of-elements = 2) then
(prepCom:create-label-text($label-elements[1]),
element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
element tei:seg {
attribute type {"label-separator"}
},
prepCom:create-label-text($label-elements[2]))
......
......@@ -95,7 +95,7 @@ declare function presort:sort-integrations($nodes as node()*) as node()* {
let $integration-target-id := replace($linking-node-corresp/@target, "#", "")
let $integration-comment := $linking-node-corresp/ancestor::*[last()]//*[@xml:id = $integration-target-id]
return
element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
element tei:seg {
attribute type {"integration"},
$integration-comment,
$linking-node-corresp,
......
......@@ -401,7 +401,7 @@ declare function simpleHelpers:find-chars($node as element(tei:lb)) as node()* {
let $next-char := substring($next-first-text, 1, 1)
let $milestone :=
element {QName("http://www.tei-c.org/ns/1.0", "milestone")} {
element tei:milestone {
attribute unit {"line"}
}
......@@ -426,7 +426,7 @@ as text() {
declare function simpleHelpers:start-line($node as element())
as element(tei:milestone) {
element {QName("http://www.tei-c.org/ns/1.0", "milestone")} {
element tei:milestone {
attribute unit {"line"},
if($node/@rend) then
attribute rendition {$node/@rend}
......
......@@ -449,14 +449,14 @@ declare function tidySimple:split-headings($nodes as node()*) as node()* {
return
element {QName("http://www.tei-c.org/ns/1.0", $node/name())} {
$node/@*,
(element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
(element tei:seg{
attribute type {"upper-part"},
$split-top
},
element {QName("http://www.tei-c.org/ns/1.0", "lb")} {
element tei:lb{
attribute type {"edited_text"}
},
element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
element tei:seg{
attribute type {"lower-part"},
$split-bottom
})
......@@ -474,14 +474,14 @@ declare function tidySimple:split-headings($nodes as node()*) as node()* {
if($node/tei:add[@type = "edited_text" and @subtype = "interlinear"]) then
let $add := $node/tei:add[@type = "edited_text" and @subtype = "interlinear"]
return
(element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
(element tei:seg{
attribute type {"upper-part"},
$add/node()
},
element {QName("http://www.tei-c.org/ns/1.0", "lb")} {
element tei:lb{
attribute type {"edited_text"}
},
element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
element tei:seg{
attribute type {"lower-part"},
$add/following-sibling::node()
})
......@@ -504,7 +504,7 @@ declare function tidySimple:summarize-entries($nodes as node()*) as node()* {
let $bla := util:log-system-out($this-content)
return
element {QName("http://www.tei-c.org/ns/1.0", "hi")} {
element tei:hi {
$this-content,
tidySimple:get-next-content($node, ())
}
......@@ -543,7 +543,7 @@ declare function tidySimple:get-Fontanes-sources($header as node()*) {
()
case element(tei:derivation) return
element {QName("http://www.tei-c.org/ns/1.0", "derivation")} {
element tei:derivation {
for $ref in $node//tei:link
let $target := substring-after($ref/@target, " ")
let $abbrev := index-info:get-info-about("lit", $target, "abbrev")
......@@ -554,7 +554,7 @@ declare function tidySimple:get-Fontanes-sources($header as node()*) {
else
()
return
element {QName("http://www.tei-c.org/ns/1.0", "term")} {
element tei:term {
$abbrev,
if($confer) then
"; vgl. " || $confer
......@@ -611,7 +611,7 @@ declare function tidySimple:summarize-rs($nodes as node()*) as node()* {
let $target-id := replace($node/@next, "#", "")
return
if($node/following-sibling::node()[1][self::tei:rs][@xml:id = $target-id]) then
element {QName("http://www.tei-c.org/ns/1.0", "rs")} {
element tei:rs {
$node/(@* except @next),
$node/node(),
$node/following-sibling::node()[1][self::tei:rs][@xml:id = $target-id]/node()
......
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