Commit d5d918fd authored by mrodzis's avatar mrodzis 🌎
Browse files

Experiment with presort

parent bc9f9e60
......@@ -76,29 +76,29 @@ declare function presort:sort($nodes as node()*) as node()* {
case comment() return
()
case element(tei:rs) return
(: for nodes that only have text :)
if($node[@next and not(child::*)]) then
let $next-node := presort:find-corresp-node($node, "next")
return
if($next-node[not(child::*)]) then
($node, $next-node)
else
presort:exclude-copied($node)
(: for nodes that only have text :)
else if($node[@prev and not(child::*)]) then
let $prev-node := presort:find-corresp-node($node, "prev")
return
if($prev-node[not(child::*)]) then
()
else
presort:exclude-copied($node)
(: for nodes that only have a tei:hi that is part of a virtual
aggregation. these nodes will be processed in tei:hi :)
else if($node[child::hi[@prev] and count(child::*)= 1]) then
presort:sort($node/node())
else
presort:exclude-copied($node)
(: case element(tei:rs) return:)
(: (: for nodes that only have text :):)
(: if($node[@next and not(child::*)]) then:)
(: let $next-node := presort:find-corresp-node($node, "next"):)
(: return:)
(: if($next-node[not(child::*)]) then:)
(: ($node, $next-node):)
(: else:)
(: presort:exclude-copied($node):)
(: (: for nodes that only have text :):)
(: else if($node[@prev and not(child::*)]) then:)
(: let $prev-node := presort:find-corresp-node($node, "prev"):)
(: return:)
(: if($prev-node[not(child::*)]) then:)
(: ():)
(: else:)
(: presort:exclude-copied($node):)
(: (: for nodes that only have a tei:hi that is part of a virtual :)
(: aggregation. these nodes will be processed in tei:hi :):)
(: else if($node[child::hi[@prev] and count(child::*)= 1]) then:)
(: presort:sort($node/node()):)
(: else:)
(: presort:exclude-copied($node):)
case element(tei:hi) return
......@@ -124,6 +124,7 @@ declare function presort:sort($nodes as node()*) as node()* {
};
declare function presort:keep-node($node as node()*) as node()* {
util:log-system-out($node),
element {QName("http://www.tei-c.org/ns/1.0", $node/name())} {
$node/@*,
(: $node/(@* except (@prev, @next)), (: attrs only visible for debugging :):)
......
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