Commit 9c6772bb authored by mrodzis's avatar mrodzis 🌎
Browse files

Improve summarizigng process (cf. 2cca4917)

parent 6bddd39f
...@@ -76,7 +76,7 @@ as xs:boolean { ...@@ -76,7 +76,7 @@ as xs:boolean {
: :) : :)
declare function simpleHelpers:prepare-text($node as text()) as text()? { declare function simpleHelpers:prepare-text($node as text()) as text()? {
if(not(normalize-space($node) = "")) then if(not(normalize-space($node) = "")) then
(: the @ serves as a flag for the removal of hyphens. this is necessary (: the @P serves as a flag for the removal of hyphens. this is necessary
since we sometimes have cases where a hyphen is the only content of a since we sometimes have cases where a hyphen is the only content of a
string. functx:substring-before-last would therefore produce an empty string. functx:substring-before-last would therefore produce an empty
string which leads to problems while preparing the text any further. :) string which leads to problems while preparing the text any further. :)
......
...@@ -411,15 +411,13 @@ declare function tidySimple:summarize-entries($nodes as node()*) as node()* { ...@@ -411,15 +411,13 @@ declare function tidySimple:summarize-entries($nodes as node()*) as node()* {
$node $node
case element(tei:hi) return case element(tei:hi) return
if($node[@next]) then if($node/@next and not($node/@prev)) then
let $this-content := $node/child::text() let $this-content := $node/child::text()
let $next-content := $node/following-sibling::tei:hi[1]/child::text()
let $break := if($node/@break = "true") then text{" "} else ()
let $content := ($this-content, $break, $next-content)
return return
element {QName("http://www.tei-c.org/ns/1.0", "hi")} { element {QName("http://www.tei-c.org/ns/1.0", "hi")} {
$content $this-content,
tidySimple:get-next-content($node, ())
} }
else if($node[@prev]) then else if($node[@prev]) then
() ()
...@@ -428,4 +426,19 @@ declare function tidySimple:summarize-entries($nodes as node()*) as node()* { ...@@ -428,4 +426,19 @@ declare function tidySimple:summarize-entries($nodes as node()*) as node()* {
default return default return
tidySimple:copy-element($node, "summarize") tidySimple:copy-element($node, "summarize")
};
declare function tidySimple:get-next-content($node as node()*, $content as node()*)
as node()* {
if($node/@next) then
let $next-hi-id := substring-after($node/@next, "#")
let $next-node := $node/following-sibling::*[@xml:id = $next-hi-id]
let $next-content := $next-node/text()
let $break := if($node/@break = "true") then text{" "} else ()
let $content := ($content, $break, $next-content)
return
tidySimple:get-next-content($next-node, $content)
else
$content
}; };
\ No newline at end of file
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