diff --git a/modules/intermediate_format/ifweb.xql b/modules/intermediate_format/ifweb.xql index efb955fdf56d8941a740f6afc9fab8842e302ded..356dad32121fb6c1b0f4216c0f6a952f5c3f2e50 100644 --- a/modules/intermediate_format/ifweb.xql +++ b/modules/intermediate_format/ifweb.xql @@ -64,6 +64,7 @@ $target-dir as xs:string) as node()* { declare function ifweb:transform-split-xml($xml as node()*, $filename as xs:string, $dir as xs:string) { let $preprocessed-data := pre:preprocessing($xml/*, $ifweb:replace-whitespace) + let $editorial-notes := pre:get-editorial-notes($xml/*, $ifweb:replace-whitespace) let $intermediate-format := ident:walk($preprocessed-data, ()) (: sometimes we have structural variance on chapter level - in these cases @@ -84,7 +85,8 @@ $dir as xs:string) { let $transformed := element tei:div { - $content + $content, + $editorial-notes } let $store := xmldb:store($dir, $filename, $transformed) diff --git a/modules/intermediate_format/preprocessing.xqm b/modules/intermediate_format/preprocessing.xqm index 54c89ac0d44ca5378819385294ae6d646d70fb09..25b6c4c589882cfa8eab5568c02de2326bdf2270 100644 --- a/modules/intermediate_format/preprocessing.xqm +++ b/modules/intermediate_format/preprocessing.xqm @@ -51,9 +51,7 @@ declare function pre:preprocessing-textNode element{$node/name()}{ $node/@*, pre:preprocessing-textNode($node/node()), - element{"editorial-notes"}{ - $node//note[@type eq "editorial-commentary"] - } + pre:get-editorial-notes($node, $replace-whitespace) } ) @@ -166,11 +164,7 @@ declare function pre:preprocessing element{$node/name()}{ $node/@*, pre:preprocessing($node/node(), $replace-whitespace), - element{"editorial-notes"}{ - for $editorial-note in $node//note[@type eq "editorial-commentary"] - return - pre:default-element( $editorial-note, pre:preprocessing($editorial-note/node(), $replace-whitespace) ) - } + pre:get-editorial-notes($node, $replace-whitespace) } ) @@ -312,3 +306,16 @@ declare function pre:preprocessing pre:default-element( $node, pre:preprocessing($node/node(), $replace-whitespace) ) ) }; + +(:~ + : Returns all editorial notes of a document in a new element. + : + : @author Michelle Weidling :) +declare function pre:get-editorial-notes($node as node()*, $replace-whitespace) +as element(editorial-notes) { + element{"editorial-notes"}{ + for $editorial-note in $node//note[@type eq "editorial-commentary"] + return + pre:default-element($editorial-note, pre:preprocessing($editorial-note/node(), $replace-whitespace)) + } +};