Commit 3881a7da authored by MRodz's avatar MRodz Committed by mrodzis
Browse files

Switch from @type='handshift' to @unit

parent b7714f71
......@@ -792,7 +792,7 @@ as element(tei:milestone) {
let $prev-hand := $node/preceding::tei:handShift[@new][1]
return
element tei:milestone {
attribute type {"handshift"},
attribute unit {"handshift"},
attribute subtype {if($node/@new) then $node/@new else $prev-hand/@new},
attribute rend {concat("script(", (if($node/@script) then $node/@script else ""), ") ",
"medium(", (if($node/@medium) then $node/@medium else ""), ")")},
......
......@@ -163,7 +163,7 @@ declare function simpleHelpers:has-valid-text($node as node()) as xs:boolean {
: @return xs:boolean
:)
declare function simpleHelpers:is-valid-text($node as text()) as xs:boolean {
let $current-hand := $node/preceding::tei:milestone[@type = "handshift"][@subtype][1]/@subtype
let $current-hand := $node/preceding::tei:milestone[@unit = "handshift"][@subtype][1]/@subtype
return
if((simpleHelpers:is-hand-contemporary($current-hand)
or ($node[ancestor::tei:surface[@type = "label"]]
......@@ -284,7 +284,7 @@ declare function simpleHelpers:filter-rendition($node as node()) as xs:string* {
: @author Michelle Rodzis
: @param $hands a string sequence containing all contemporary hands that are
: declared in tei:handNotes
: @param $node the current tei:milestone[@type = "handshift"] element
: @param $node the current tei:milestone[@unit = "handshift"] element
: @return xs:boolean
:)
declare function simpleHelpers:is-hand-valid($hands as xs:string*,
......@@ -304,14 +304,14 @@ $node as element(tei:milestone)) as xs:boolean {
declare function simpleHelpers:belongs-to-valid-hand($hands as xs:string*,
$node as element(*)*) as xs:boolean {
(: in some cases elements like tei:front or tei:body don't have a preceeding
tei:milestone[@type = "handshift"] because the initial pages are empty.
tei:milestone[@unit = "handshift"] because the initial pages are empty.
in these cases we want to preserve the element and therefore set a valid
tei:milestone[@type = "handshift"] :)
tei:milestone[@unit = "handshift"] :)
let $prev-hand :=
if($node/preceding::tei:milestone[@type = "handshift"][1]) then
$node/preceding::tei:milestone[@type = "handshift"][1]
if($node/preceding::tei:milestone[@unit = "handshift"][1]) then
$node/preceding::tei:milestone[@unit = "handshift"][1]
else
<tei:milestone type="handshift" subtype="#Fontane"/>
<tei:milestone unit="handshift" subtype="#Fontane"/>
return
if(simpleHelpers:is-hand-valid($hands, $prev-hand)) then
true()
......@@ -322,22 +322,22 @@ $node as element(*)*) as xs:boolean {
declare function simpleHelpers:find-prev-valid-hand($hands as xs:string*,
$node as element(tei:milestone)) as element(tei:milestone){
$node/preceding::tei:milestone[@type = "handshift"][1][simpleHelpers:is-hand-valid($hands, $node)]
$node/preceding::tei:milestone[@unit = "handshift"][1][simpleHelpers:is-hand-valid($hands, $node)]
};
(:~
: Checks if the previous milestone[@type = "handshift"] is the same as the
: current milestone[@type = "handshift"]. They are the same if they have the
: Checks if the previous milestone[@unit = "handshift"] is the same as the
: current milestone[@unit = "handshift"]. They are the same if they have the
: same attributes.
:
: @author Michelle Rodzis
: @param $node the current tei:milestone[@type = "handshift"] element
: @param $node the current tei:milestone[@unit = "handshift"] element
: @return xs:boolean
:)
declare function simpleHelpers:is-prev-valid-hand-same($hands as xs:string,
$node as element(tei:milestone)) as xs:boolean {
let $prev-valid-hand := simpleHelpers:find-prev-valid-hand($hands, $node)
let $prev-hand := $node/preceding::tei:milestone[@type = "handshift"][1]
let $prev-hand := $node/preceding::tei:milestone[@unit = "handshift"][1]
return
(: since we can't take the order of the attributes for granted we can't
use functx:sequence-deep-equal :)
......@@ -351,17 +351,17 @@ $node as element(tei:milestone)) as xs:boolean {
};
(:~
: Checks if the previous milestone[@type = "handshift"] is the same as the
: current milestone[@type = "handshift"]. They are the same if they have the
: Checks if the previous milestone[@unit = "handshift"] is the same as the
: current milestone[@unit = "handshift"]. They are the same if they have the
: same attributes.
:
: @author Michelle Rodzis
: @param $node the current tei:milestone[@type = "handshift"] element
: @param $node the current tei:milestone[@unit = "handshift"] element
: @return xs:boolean
:)
declare function simpleHelpers:is-prev-hand-same($node as element(tei:milestone))
as xs:boolean {
let $prev-hand := $node/preceding::tei:milestone[@type = "handshift"][1]
let $prev-hand := $node/preceding::tei:milestone[@unit = "handshift"][1]
return
(: since we can't take the order of the attributes for granted we can't
use functx:sequence-deep-equal :)
......
......@@ -13,11 +13,11 @@ declare namespace test="http://exist-db.org/xquery/xqsuite";
(: handshifts :)
declare
%test:name("handShift - Sort out invalid ones")
%test:args("<milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#Stempel2""/>")
%test:args("<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#Stempel2""/>")
%test:assertEmpty
%test:args("<milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#Fontane"" rend=""script(Latf) medium()""/>")
%test:assertEquals("<milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#Fontane"" rend=""script(Latf) medium()""/>")
%test:args("<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#Fontane"" rend=""script(Latf) medium()""/>")
%test:assertEquals("<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#Fontane"" rend=""script(Latf) medium()""/>")
function tidysimple-test:handShift-invalid($node as element(*)) {
tidySimple:sort-out-invalid-hands($node)
......@@ -25,13 +25,13 @@ declare
declare
%test:name("handShift - Sort out invalid nodes after an invalid hand")
%test:args("<body xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#Friedrich_Fontane"" rend=""script(Latn clean) medium(black_ink)""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/><seg xmlns=""http://www.tei-c.org/ns/1.0"" rendition=""font-size:small"">Dieses Buch hat 52 Blatt.</seg></body>")
%test:args("<body xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#Friedrich_Fontane"" rend=""script(Latn clean) medium(black_ink)""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/><seg xmlns=""http://www.tei-c.org/ns/1.0"" rendition=""font-size:small"">Dieses Buch hat 52 Blatt.</seg></body>")
%test:assertEquals("<body xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/></body>")
%test:args("<body xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#Friedrich_Fontane"" rend=""script(Latn clean) medium(black_ink)""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/><seg xmlns=""http://www.tei-c.org/ns/1.0"" rendition=""font-size:small"">Dieses Buch hat 52 Blatt.</seg><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#Fontane"" rend=""script(Latn clean) medium(black_ink)""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""paragraph""/><seg xmlns=""http://www.tei-c.org/ns/1.0"" rendition=""font-size:small"">Text von Fontane</seg><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""paragraph""/></body>")
%test:assertEquals("<body xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#Fontane"" rend=""script(Latn clean) medium(black_ink)""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""paragraph""/><seg xmlns=""http://www.tei-c.org/ns/1.0"" rendition=""font-size:small"">Text von Fontane</seg><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""paragraph""/></body>")
%test:args("<body xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#Friedrich_Fontane"" rend=""script(Latn clean) medium(black_ink)""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/><seg xmlns=""http://www.tei-c.org/ns/1.0"" rendition=""font-size:small"">Dieses Buch hat 52 Blatt.</seg><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#Fontane"" rend=""script(Latn clean) medium(black_ink)""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""paragraph""/><seg xmlns=""http://www.tei-c.org/ns/1.0"" rendition=""font-size:small"">Text von Fontane</seg><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""paragraph""/></body>")
%test:assertEquals("<body xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#Fontane"" rend=""script(Latn clean) medium(black_ink)""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""paragraph""/><seg xmlns=""http://www.tei-c.org/ns/1.0"" rendition=""font-size:small"">Text von Fontane</seg><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""paragraph""/></body>")
%test:args("<div xmlns=""http://www.tei-c.org/ns/1.0"" type=""label"" xml:id=""a4""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#fremde_Hand3"" rend=""script(Latn clean) medium()""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line"" rendition=""align(center)""/>✓ </div>")
%test:args("<div xmlns=""http://www.tei-c.org/ns/1.0"" type=""label"" xml:id=""a4""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#fremde_Hand3"" rend=""script(Latn clean) medium()""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line"" rendition=""align(center)""/>✓ </div>")
%test:assertEquals("<div xmlns=""http://www.tei-c.org/ns/1.0"" type=""label"" xml:id=""a4""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line"" rendition=""align(center)""/></div>")
function tidysimple-test:handShift-invalid($node as element(*)) {
......@@ -40,14 +40,14 @@ declare
declare
%test:name("handShift - Sort out surplus ones")
%test:args("<div xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#Fontane"" rend=""script(Latf clean) medium()""/>Some text<milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#Fontane"" rend=""script(Latn clean) medium()""/></div>")
%test:assertEquals("<div xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#Fontane"" rend=""script(Latf clean) medium()""/>Some text<milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#Fontane"" rend=""script(Latn clean) medium()""/></div>")
%test:args("<div xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#Fontane"" rend=""script(Latf clean) medium()""/>Some text<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#Fontane"" rend=""script(Latn clean) medium()""/></div>")
%test:assertEquals("<div xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#Fontane"" rend=""script(Latf clean) medium()""/>Some text<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#Fontane"" rend=""script(Latn clean) medium()""/></div>")
%test:args("<div xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#Fontane"" rend=""script(Latn clean) medium()""/>Some text<milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#Fontane"" rend=""script(Latn clean) medium()""/></div>")
%test:assertEquals("<div xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#Fontane"" rend=""script(Latn clean) medium()""/>Some text</div>")
%test:args("<div xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#Fontane"" rend=""script(Latn clean) medium()""/>Some text<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#Fontane"" rend=""script(Latn clean) medium()""/></div>")
%test:assertEquals("<div xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#Fontane"" rend=""script(Latn clean) medium()""/>Some text</div>")
%test:args("<body xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#Fontane"" rend=""script(Latf standard) medium()""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#Fontane"" rend=""script() medium()""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""section"" type=""Text_1"" spanTo=""#C07_3r_s""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#Fontane"" rend=""script(Latn clean) medium()""/><head xmlns=""http://www.tei-c.org/ns/1.0"" type=""x-large"" rend=""align(center)""><rs xmlns=""http://www.tei-c.org/ns/1.0"" type=""direct"" ref=""psn:Luther""><hi xmlns=""http://www.tei-c.org/ns/1.0"">Luther</hi></rs></head></body>")
%test:assertEquals("<body xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""section"" type=""Text_1"" spanTo=""#C07_3r_s""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#Fontane"" rend=""script(Latn clean) medium()""/><head xmlns=""http://www.tei-c.org/ns/1.0"" type=""x-large"" rend=""align(center)""><rs xmlns=""http://www.tei-c.org/ns/1.0"" type=""direct"" ref=""psn:Luther""><hi xmlns=""http://www.tei-c.org/ns/1.0"">Luther</hi></rs></head></body>")
%test:args("<body xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#Fontane"" rend=""script(Latf standard) medium()""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#Fontane"" rend=""script() medium()""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""section"" type=""Text_1"" spanTo=""#C07_3r_s""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#Fontane"" rend=""script(Latn clean) medium()""/><head xmlns=""http://www.tei-c.org/ns/1.0"" type=""x-large"" rend=""align(center)""><rs xmlns=""http://www.tei-c.org/ns/1.0"" type=""direct"" ref=""psn:Luther""><hi xmlns=""http://www.tei-c.org/ns/1.0"">Luther</hi></rs></head></body>")
%test:assertEquals("<body xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""section"" type=""Text_1"" spanTo=""#C07_3r_s""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#Fontane"" rend=""script(Latn clean) medium()""/><head xmlns=""http://www.tei-c.org/ns/1.0"" type=""x-large"" rend=""align(center)""><rs xmlns=""http://www.tei-c.org/ns/1.0"" type=""direct"" ref=""psn:Luther""><hi xmlns=""http://www.tei-c.org/ns/1.0"">Luther</hi></rs></head></body>")
function tidysimple-test:handShift-surplus($node as element(*)) {
tidySimple:sort-out-surplus-hands($node)
......@@ -58,8 +58,8 @@ declare
declare
%test:name("Sections")
(: %test:args("<body xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""section"" type=""Text_2"" spanTo=""#C07_4r_s""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#Fontane"" rend=""script(Latn clean) medium()""/><head xmlns=""http://www.tei-c.org/ns/1.0"" type=""x-large"" rend=""align(center)""><seg xmlns=""http://www.tei-c.org/ns/1.0"" rendition=""font-size:x-large; letter-spacing:0.2cm""><rs type=""direct"" ref=""psn:Cranach""><hi xmlns=""http://www.tei-c.org/ns/1.0"">Lucas Cranach</hi></rs>.</seg></head><milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#Fontane"" rend=""script(Latf clean) medium()""/><anchor xmlns=""http://www.tei-c.org/ns/1.0"" xml:id=""C07_4r_s""/></body>"):)
(: %test:assertEquals("<body xmlns=""http://www.tei-c.org/ns/1.0""><div xmlns=""http://www.tei-c.org/ns/1.0"" type=""section""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#Fontane"" rend=""script(Latn clean) medium()""/><head xmlns=""http://www.tei-c.org/ns/1.0"" type=""x-large"" rend=""align(center)""><seg xmlns=""http://www.tei-c.org/ns/1.0"" rendition=""font-size:x-large; letter-spacing:0.2cm""><rs type=""direct"" ref=""psn:Cranach""><hi xmlns=""http://www.tei-c.org/ns/1.0"">Lucas Cranach</hi></rs>.</seg></head><milestone xmlns=""http://www.tei-c.org/ns/1.0"" type=""handshift"" subtype=""#Fontane"" rend=""script(Latf clean) medium()""/></div></body>") :)
(: %test:args("<body xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""section"" type=""Text_2"" spanTo=""#C07_4r_s""/><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#Fontane"" rend=""script(Latn clean) medium()""/><head xmlns=""http://www.tei-c.org/ns/1.0"" type=""x-large"" rend=""align(center)""><seg xmlns=""http://www.tei-c.org/ns/1.0"" rendition=""font-size:x-large; letter-spacing:0.2cm""><rs type=""direct"" ref=""psn:Cranach""><hi xmlns=""http://www.tei-c.org/ns/1.0"">Lucas Cranach</hi></rs>.</seg></head><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#Fontane"" rend=""script(Latf clean) medium()""/><anchor xmlns=""http://www.tei-c.org/ns/1.0"" xml:id=""C07_4r_s""/></body>"):)
(: %test:assertEquals("<body xmlns=""http://www.tei-c.org/ns/1.0""><div xmlns=""http://www.tei-c.org/ns/1.0"" type=""section""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#Fontane"" rend=""script(Latn clean) medium()""/><head xmlns=""http://www.tei-c.org/ns/1.0"" type=""x-large"" rend=""align(center)""><seg xmlns=""http://www.tei-c.org/ns/1.0"" rendition=""font-size:x-large; letter-spacing:0.2cm""><rs type=""direct"" ref=""psn:Cranach""><hi xmlns=""http://www.tei-c.org/ns/1.0"">Lucas Cranach</hi></rs>.</seg></head><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""handshift"" subtype=""#Fontane"" rend=""script(Latf clean) medium()""/></div></body>") :)
%test:args("<body xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/><rs xmlns=""http://www.tei-c.org/ns/1.0"" type=""direct"" ref=""psn:Amalberga""><hi xmlns=""http://www.tei-c.org/ns/1.0"" xml:id=""C07_7r_d"" prev=""#C07_7r_c"">Amalberga</hi></rs></body>")
%test:assertEquals("<body xmlns=""http://www.tei-c.org/ns/1.0""><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/><rs xmlns=""http://www.tei-c.org/ns/1.0"" type=""direct"" ref=""psn:Amalberga""><hi xmlns=""http://www.tei-c.org/ns/1.0"" xml:id=""C07_7r_d"" prev=""#C07_7r_c"">Amalberga</hi></rs></body>")
......
......@@ -59,8 +59,8 @@ as node()* {
for $node in $nodes return
typeswitch ($node)
case text() return
if($node/preceding::tei:milestone[@type = "handshift"][1]
and not(simpleHelpers:is-hand-valid($tidySimple:valid-hands, $node/preceding::tei:milestone[@type = "handshift"][1]))) then
if($node/preceding::tei:milestone[@unit = "handshift"][1]
and not(simpleHelpers:is-hand-valid($tidySimple:valid-hands, $node/preceding::tei:milestone[@unit = "handshift"][1]))) then
()
else
$node
......@@ -69,13 +69,13 @@ as node()* {
which references the lines in the notebooks. if we omitted @unit = "line"
referencing wouldn't work any longer :)
case element(tei:milestone) return
let $prev-handshift := $node/preceding::tei:milestone[@type = "handshift"][1]
let $prev-handshift := $node/preceding::tei:milestone[@unit = "handshift"][1]
return
if($node/@type = "handshift" and
if($node/@unit = "handshift" and
simpleHelpers:is-hand-valid($tidySimple:valid-hands, $node)) then
tidySimple:clear-handshift($node)
else if($node/@type = "handshift") then
else if($node/@unit = "handshift") then
()
else if($prev-handshift
......@@ -91,7 +91,7 @@ as node()* {
tidySimple:copy-element($node, "post")
default return
let $prev-handshift := $node/preceding::tei:milestone[@type = "handshift"][1]
let $prev-handshift := $node/preceding::tei:milestone[@unit = "handshift"][1]
return
if($prev-handshift
and not(simpleHelpers:is-hand-valid($tidySimple:valid-hands, $prev-handshift))) then
......@@ -109,7 +109,7 @@ as node()* {
$node
case element(tei:milestone) return
if($node/@type ="handshift") then
if($node/@unit = "handshift") then
if(simpleHelpers:is-prev-hand-same($node)
or not(tidySimple:has-hand-text($node))) then
()
......@@ -130,7 +130,7 @@ as node()* {
declare function tidySimple:has-hand-text($node as element(tei:milestone))
as xs:boolean {
let $next-handshift := $node/following::tei:milestone[@type = "handshift"][1]
let $next-handshift := $node/following::tei:milestone[@unit = "handshift"][1]
let $nodes-between := $node/following::node()[. << $next-handshift]
let $is-text-node :=
for $node-between in $nodes-between
......@@ -167,16 +167,16 @@ declare function tidySimple:copy-element($node as node(), $flag as xs:string)
};
(:~
: Purges surplus attributes from tei:milestone[@type = "handshift"].
: Purges surplus attributes from tei:milestone[@unit = "handshift"].
:
: @author Michelle Rodzis
: @param $node the current tei:milestone[@type = "handshift"]
: @return the purged tei:milestone[@type = "handshift"]
: @param $node the current tei:milestone[@unit = "handshift"]
: @return the purged tei:milestone[@unit = "handshift"]
: :)
declare function tidySimple:clear-handshift($node as element(tei:milestone))
as element(tei:milestone) {
element tei:milestone {
attribute type {"handshift"},
attribute unit {"handshift"},
if($node/@subtype = "") then
()
else
......
This diff is collapsed.
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