Commit cbe1c266 authored by MRodz's avatar MRodz Committed by mrodzis
Browse files

Start 3.12 empty pages

parent 9c5a1766
......@@ -220,6 +220,19 @@ declare
fontane-simple:transform($node)
};
(: 3.12 EMPTY PAGES :)
declare
%test:name("Empty pages")
%test:args("<surface xmlns=""http://www.tei-c.org/ns/1.0"" n=""30r""><zone xmlns=""http://www.tei-c.org/ns/1.0""><handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Archivar2""/><line xmlns=""http://www.tei-c.org/ns/1.0"" style=""margin-left:5.7cm""><fw xmlns=""http://www.tei-c.org/ns/1.0"" type=""pageNum"">[<handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Archivar1""/>26<handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Archivar2""/>]</fw></line><line xmlns=""http://www.tei-c.org/ns/1.0"" style=""margin-left:6.2cm""><fw xmlns=""http://www.tei-c.org/ns/1.0"" type=""pageNum"">30</fw></line><handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Fontane""/></zone></surface>")
%test:assertEquals("<pb xmlns=""http://www.tei-c.org/ns/1.0"" n=""30r""/>")
(: adapt when further pages are implemented :)
%test:args("<surface xmlns=""http://www.tei-c.org/ns/1.0"" n=""26r"" type=""fragment"" attachment=""torn""><zone xmlns=""http://www.tei-c.org/ns/1.0""><handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Archivar1""/><line xmlns=""http://www.tei-c.org/ns/1.0"" style=""margin-left:0.5cm""><fw xmlns=""http://www.tei-c.org/ns/1.0"" type=""pageNum"">26</fw></line><handShift new=""#Fontane""/><line>Gewöhnliches Briefpapier.</line></zone></surface>")
%test:assertEquals("<pb xmlns=""http://www.tei-c.org/ns/1.0"" n=""26r""/>", "<div xmlns=""http://www.tei-c.org/ns/1.0"" type=""fragment"" attachment=""torn""><handShift new=""#Fontane""/>Gewöhnliches Briefpapier.</div>")
function teisimple-test:analyze-empty-pages($node as element(*)) {
fontane-simple:transform($node)
};
(: GEMINATION :)
......
......@@ -233,8 +233,7 @@ declare function fontane-simple:transform($nodes as node()*) as node()* {
(element tei:pb{
attribute n {$node/@n}
},
(: if all descendant text nodes shoudln't be serialized, z.g. parent::fw or parent::stamp :)
if($node)
if(local:has-valid-text($node))
then
element tei:div{
attribute type {"page"},
......@@ -410,24 +409,6 @@ declare function fontane-simple:transform($nodes as node()*) as node()* {
fontane-simple:transform($node/node())
};
declare function fontane-simple:transform-header($nodes as node()*) as node()* {
for $node in $nodes return
typeswitch ($node)
case text() return
$node
case element(tei:persName) return
element {QName("http://www.tei-c.org/ns/1.0", "rs")}{
attribute type {"person"},
$node/@*,
fontane-simple:transform-header($node/node())
}
default return
local:keep-header-element($node)
};
(: TODO: adapt to general XML :)
declare function fontane-simple:is-hand-contemporary($hand as xs:string) as xs:boolean {
let $hand := replace($hand, "#", "")
......@@ -484,9 +465,7 @@ declare function local:keep-element($node as node()) as node() {
}
};
declare function local:keep-header-element($node as node()) as node() {
element {QName("http://www.tei-c.org/ns/1.0", $node/name())}{
$node/@*,
fontane-simple:transform-header($node/node())
}
declare function local:has-valid-text($node as node()) as xs:boolean {
(: TODO :)
true()
};
\ No newline at end of file
This diff is collapsed.
Supports Markdown
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