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

Tidy up attributes and make tei:div creation generic

parent 3545c2ed
......@@ -35,7 +35,7 @@ declare
%test:assertEquals("<pb xmlns=""http://www.tei-c.org/ns/1.0"" n=""Ir""/>")
%test:args("<surface xmlns=""http://www.tei-c.org/ns/1.0"" n=""30var"" facs=""http://textgridrep.org/textgrid:167nm"" type=""clipping"" subtype=""Zeitungsausschnitt"" attachment=""formerly_partially_glued""><line xmlns=""http://www.tei-c.org/ns/1.0"">Test</line></surface>")
%test:assertEquals("<pb xmlns=""http://www.tei-c.org/ns/1.0"" n=""30var""/>","<div xmlns=""http://www.tei-c.org/ns/1.0"" type=""clipping"" subtype=""Zeitungsausschnitt"" attachment=""formerly_partially_glued"">Test</div>")
%test:assertEquals("<pb xmlns=""http://www.tei-c.org/ns/1.0"" n=""30var""/>","<div xmlns=""http://www.tei-c.org/ns/1.0"" type=""clipping"">Test</div>")
%test:args("<surface xmlns=""http://www.tei-c.org/ns/1.0"" n=""30var"" facs=""http://textgridrep.org/textgrid:167nm"" type=""pocket"" subtype=""angeklebte_cremefarbige_Tasche_von_Fontane_angefertigt_-_Angeklebtes_Blatt"" attachment=""formerly_partially_glued""><line xmlns=""http://www.tei-c.org/ns/1.0"">Test</line></surface>")
%test:assertEquals("<pb xmlns=""http://www.tei-c.org/ns/1.0"" n=""30var""/>")
......@@ -292,11 +292,11 @@ declare
declare
%test:name("Empty pages")
%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""/></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""/>")
%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""/>")
(: 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>")
%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""><handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Fontane""/>Gewöhnliches Briefpapier.</div>")
function teisimple-test:analyze-page-fragment($node as element(*)) {
fontane-simple:transform($node)
};
......@@ -309,7 +309,7 @@ declare
(: 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>")
%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""><handShift new=""#Fontane""/>Gewöhnliches Briefpapier.</div>")
function teisimple-test:analyze-empty-pages($node as element(*)) {
fontane-simple:transform($node)
};
......
......@@ -227,48 +227,46 @@ declare function fontane-simple:transform($nodes as node()*) as node()* {
(),
element tei:div {
attribute type {$node/@n},
$node/((@* except @facs) except @n),
$node/(@* except (@facs, @n)),
fontane-simple:transform($node/node())
})
else if(matches($node/@n, "[0-9IVXMCD]{1,7}[rv]{1}")
and $node/@type = "clipping") then
(local:make-pb($node),
(if(not($node/@subtype = "Kalenderblatt"
or $node/@subtype = "Zeitungsausschnitt_Fragment")) then
element tei:div{
$node/((@* except @facs) except @n),
fontane-simple:transform($node/node())
}
local:make-div($node)
else
()))
else if(matches($node/@n, "[0-9IVXMCD]{1,7}[rv]{1}")
and $node/@type = "fragment") then
(local:make-pb($node),
element tei:div{
$node/((@* except @facs) except @n),
fontane-simple:transform($node/node())
})
local:make-div($node))
else if(matches($node/@n, "[0-9IVXMCD]{1,7}[rv]{1}")
and $node/@type = "pocket") then
local:make-pb($node)
local:make-pb($node)
else if(matches($node/@n, "[0-9IVXMCD]{1,7}[rv]{1}")
and $node/@type = "label" and $node/@subtype = "Oblate") then
()
else if(matches($node/@n, "[0-9IVXMCD]{1,7}[rv]{1}")) then
(local:make-pb($node),
element tei:div{
attribute type {"page"},
$node/((@* except @facs) except @n),
$node/(@* except (@facs, @n)),
fontane-simple:transform($node/node())
})
else if($node/@type = "label" and
(contains($node/@subtype, "Fontane")
or contains($node/@subtype, "Hersteller"))
) then
element tei:div {
attribute type {"label"},
fontane-simple:transform($node/node())
}
(contains($node/@subtype, "Fontane")
or contains($node/@subtype, "Hersteller"))
) then
local:make-div($node)
else
()
......@@ -362,7 +360,7 @@ declare function fontane-simple:transform($nodes as node()*) as node()* {
local:make-heading($node)
else if($node/@type = "list" or $node/@type = "item") then
element {QName("http://www.tei-c.org/ns/1.0", $node/@type)}{
$node/(@* except @type),
$node/(@* except (@type, @ulx, @uly, @lrx, @lry, @rotate)),
fontane-simple:transform($node/node())
}
else if($node/@type = "legend") then
......@@ -466,12 +464,16 @@ declare function fontane-simple:transform($nodes as node()*) as node()* {
(if($node/@when-iso) then
attribute when {$node/@when-iso}
else
()),
()),
(if($node/@from-iso) then
attribute from {$node/@from-iso}
else
()),
(if($node/@to-iso) then
attribute to {$node/@to-iso}
else
()),
$node/((@* except @when-iso) except @to-iso),
$node/(@* except (@when-iso, @to-iso, @from-iso)),
fontane-simple:transform($node/node())
}
......@@ -564,6 +566,13 @@ declare function local:make-heading($node as node()) as element(tei:head) {
}
};
declare function local:make-div($node as node()) as element(tei:div) {
element tei:div{
$node/(@* except (@facs, @n, @attachment, @subtype, @ulx, @uly, @lrx, @lry)),
fontane-simple:transform($node/node())
}
};
declare function local:get-fontsize($node as node()) as xs:string {
(: example for style: "font-size:large; letter-spacing:0.2cm; text-decoration:underline" :)
let $tmp := substring-after($node/descendant-or-self::tei:seg[matches(@style, "font-size")]/@style, "font-size:")
......
This diff is collapsed.
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