Commit cdcf1c0d authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

Merge branch 'feature/xhtml-lesefassung' into 'develop'

Feature/xhtml lesefassung

Closes #23, print#7, #46, #45, #58, print#52, print#67, #64, #63, #81, and #82

See merge request !21
parents 9f260bd8 1ad0f87b
......@@ -167,7 +167,11 @@ declare function etTransfo:create-print-tei() as xs:string {
let $complete-print-file :=
element {QName("http://www.tei-c.org/ns/1.0", "teiCorpus")} {
$xmls,
etTransfo:get-literature()
try {
etTransfo:get-literature()
} catch * {
error(QName("error", "ETTRANSFO06"), "An error occured while creating the bibliography.")
}
}
return
xmldb:store($config:data-root || "/print/xml/", "fontane-full.xml", $complete-print-file)
......@@ -263,21 +267,52 @@ declare function etTransfo:get-literature() as element(tei:div) {
: bibliographic reference
:)
declare function etTransfo:make-bib-entries($type as xs:string) as element(tei:div)* {
for $entry in doc("/db/sade-projects/textgrid/data/xml/data/25547.xml")//tei:listBibl[@type = $type]/tei:bibl
for $choice in $entry//tei:choice
let $abbr := $choice//tei:abbr
let $full-ref := $choice//tei:expan
return
element {QName("http://www.tei-c.org/ns/1.0", "div")} {
attribute type {"entry"},
element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
attribute type {"abbr"},
$abbr
},
for $entry in doc("/db/sade-projects/textgrid/data/xml/data/25547.xml")//tei:listBibl[@type = $type]//tei:bibl
let $abbr :=
if($entry/tei:abbr) then
$entry/tei:abbr
else
$entry/tei:choice/tei:abbr
let $full-ref := $entry/tei:choice/tei:expan
let $bib-no := count($entry/ancestor::tei:bibl)
return
element {QName("http://www.tei-c.org/ns/1.0", "div")} {
attribute type {"entry"},
element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
attribute type {"abbr"},
$abbr
},
if($full-ref) then
element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
attribute type {"full"},
$full-ref
}
}
else if($entry/tei:ptr[@target]) then
let $target-id := replace($entry/tei:ptr/@target, "#", "")
let $referenced-entry := $entry/ancestor::tei:body//tei:bibl[@xml:id = $target-id]
let $same-as := $referenced-entry/tei:choice/tei:abbr/string()
let $same-as-loc := $referenced-entry/ancestor::tei:listBibl[1]/@type/string()
return
(element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
attribute type {"same-as"},
$same-as
},
element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
attribute type {"same-as-loc"},
$same-as-loc
})
else
(),
if($bib-no gt 0) then
element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
attribute type {"sub-entry"},
$bib-no
}
else
()
}
};
......@@ -44,35 +44,49 @@ declare function fsort:sort($nodes as node()*) {
case text() return
$node
case element(tei:hi) return
if($node/@next and not($node/ancestor::tei:rs)) then
let $corresp-node := fsort:find-corresp-node($node, "next")
return
(: it's not sufficient to copy only the corresp node since
this would mean we'd loose the information about the tei:rs :)
if($corresp-node[self::tei:hi and parent::tei:rs]) then
(fsort:keep-node($node),
element {QName("http://www.tei-c.org/ns/1.0", "rs")} {
$corresp-node/parent::*/@*,
$corresp-node
})
else
fsort:default-return($node)
case comment() return
if(matches($node, "transform")) then
$node
else
fsort:default-return($node)
case element(tei:rs) return
(: in this case the tei:rs is empty after fsort:apply-all-nexts. we
don't need these. :)
if($node[child::*[@prev]] and count($node/child::*) = 1) then
()
else
fsort:default-return($node)
case element(tei:zone) return
fsort:default-return($node)
(: case element(tei:hi) return:)
(: if($node/@next and not($node/ancestor::tei:rs)) then:)
(: let $corresp-node := fsort:find-corresp-node($node, "next"):)
(: return:)
(: (: it's not sufficient to copy only the corresp node since:)
(: this would mean we'd loose the information about the tei:rs :):)
(: if($corresp-node[self::tei:hi and parent::tei:rs]) then:)
(: (fsort:keep-node($node),:)
(: element {QName("http://www.tei-c.org/ns/1.0", "rs")} {:)
(: $corresp-node/parent::*/@*,:)
(: $corresp-node:)
(: }):)
(: else:)
(: fsort:default-return($node):)
(: else:)
(: fsort:default-return($node):)
(::)
(::)
(: case element(tei:rs) return:)
(: (: in this case the tei:rs is empty after fsort:apply-all-nexts. we:)
(: don't need these. :):)
(: if($node[child::*[@prev]] and count($node/child::*) = 1) then:)
(: ():)
(: else:)
(: fsort:default-return($node):)
(: :)
(: case element(tei:date) return:)
(: fsort:keep-node($node):)
(::)
(: case element(tei:ref) return:)
(: fsort:keep-node($node):)
default return
fsort:default-return($node)
fsort:keep-node($node)
};
(:~
......
......@@ -146,7 +146,7 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a
else if($node/@cause = "unclear") then
()
else if($node[matches(@copyOf, $node/preceding::tei:seg/@xml:id)]) then
else if($node[replace($node/@copyOf, "#", "") = $node/ancestor::tei:TEI//tei:seg/@xml:id]) then
fontaneSimple:mark-intervention($node, $uri)
else if($node/@cause ="catchword") then
......@@ -823,6 +823,9 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a
case element (tei:bibl) return
fontaneSimple:copy-element($node, $uri)
case element(tei:unclear) return
fontaneSimple:copy-element($node, $uri)
default return
fontaneSimple:transform($node/node(), $uri)
};
......@@ -958,7 +961,8 @@ as element(tei:milestone) {
let $whitespace-after :=
if($node/following::node()[1][normalize-space(.) = ""]
and not($node/following::*[1][@type = "heading"])) then
and not($node/following::*[1][@type = "heading"])
and not($node/following::text()[1][matches(substring(., 1, 1), "[\.,]")])) then
true()
else
false()
......@@ -1162,13 +1166,14 @@ declare function fontaneSimple:make-key($regular-name as xs:string?) {
let $affix := substring-after($regular-name, ".")
let $key :=
replace($name, "Ä", "A")
=> replace("ä", "a")
=> replace("Ö", "O")
=> replace("ö", "o")
=> replace("Ü", "U")
=> replace("ü", "u")
=> replace("ä", "ae")
=> replace("Ö", "Oe")
=> replace("ö", "oe")
=> replace("Ü", "Ue")
=> replace("ü", "ue")
=> replace(" ", "")
=> replace("\.", "")
=> replace(",", "")
return
(: sorts terms with a trailer, e.g. 'Friederich II. von Sachsen' after the ones
without, e.g. 'Friederich II.' :)
......
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