diff --git a/.gitignore b/.gitignore index bef899f0e9cb22305e31d08965ad150f349752f0..60935295ff9f81f251d46e1aae79076d3e645987 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /archive /xml +.DS_Store +.com.apple.timemachine.supported diff --git a/README.md b/README.md index 050f90121423016b0ea70db7110ad58e0c1c8fee..eb4624d4f6f9d201333f4ebf47c2e5a31aa9eade 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,36 @@ -# bdn:IntermediateFormat +# bdn:IntermediateFormat.v2 Scripts to convert bdn-TEI into an intermediate-format dealing with reading markers +# Notes in Advance + - The Directory "stable_old" contains the old version and is just of documentary nature + - The Directory "oxygen" contains files for the Development in oxygen + - The Directories "modules" and "rest" hold all files of the new Intermediate-Format version + # setup and description -## stable/modules/intermediate_format/inter_form.xqm - - This is the main module integrating the conversion functions +## modules/intermediate_format/identification.xqm + - This is the main module integrating the main conversion and node identification functions - place it in your app modules path: "/modules/intermediate_format/inter_form.xqm" -## stable/modules/string.xqm - - This is the a helper module dealing with strings - - place it in your app modules path: "/modules/string.xqm" +## modules/intermediate_format/markerset.xqm + - Functions to collect and construct markers + - place it in your app modules path: "/modules/intermediate_format/markerset.xqm" + +## modules/intermediate_format/preprocessing.xqm + - Contains the preprocessing routine + - place it in your app modules path: "/modules/intermediate_format/preprocessing.xqm" + +## modules/intermediate_format/whitespace-handling.xqm + - Functions for whitespace-handling + - place it in your app modules path: "/modules/intermediate_format/whitespace-handling.xqm" -## stable/rest/intermediate_function.xql - - This is the a conversion script running the conversion on a given document - - place it in your app somewhere or as suggested here: "/rest/intermediate_function.xql" +## rest/intermediate_function.xql + - This is the REST script running the conversion on a given document within eXist-DB + - place it in your app somewhere or as suggested here in a subfolder /rest # running the conversion - - call intermediate_function.xql via REST with the GET-Parameter "path" + - call intermediate_format.xql via REST with the GET-Parameter "path" - "path" must be a XML-URI existing in your app context (There is no exitence check yet) - wait # Sample call -http://localhost:8080/exist/rest/apps/bdn/rest/intermediate_format.xql?path=/db/apps/bdn/data/samples/griesbach_full.xml +http://localhost:8080/exist/rest/apps/YOUR_APP/rest/intermediate_format.xql?path=/db/apps/bdn/data/samples/griesbach_full.xml diff --git a/modules/intermediate_format/identification.xqm b/modules/intermediate_format/identification.xqm new file mode 100644 index 0000000000000000000000000000000000000000..8ff41e08bcf23126ec3335a7272580834bfecaf0 --- /dev/null +++ b/modules/intermediate_format/identification.xqm @@ -0,0 +1,450 @@ +xquery version "3.0"; +(:~ + : IDENTIFICATION Module ("ident", "http://bdn.edition.de/intermediate_format/identification") + : ******************************************************************************************* + : This module defines functions and variables to set reading markers in tei:lem or tei:rdg elements. + : The problem it solves is to identify non-Blocklevel-elements self not containing Blocklevel-elements + : on their first or last decendants path to set textcritical markers required in the printed version of a + : BdN digital edition. + : + : The basic idea is constructing a some kind of first- and last-descendants PATH for reading nodes (tei:lem and tei:rdg) describing + : a save PATH of non-BLE self not including Blocklevel-elements on their own first- or last-decendants paths down the tree. + : + : It includes the helping module "markerset" holding helper functions to collect and construct reading markers + + : @version 2.0 (2018-01-29) + : @note This new versions identification algorithm is more flexible and much more configurable as in the old version 1 + : @status working + : @author Uwe Sikora + :) +module namespace ident="http://bdn.edition.de/intermediate_format/identification"; +import module namespace markerset = "http://bdn.edition.de/intermediate_format/markerset" at "markerset.xqm"; + +declare default element namespace "http://www.tei-c.org/ns/1.0"; + + +(:############################# Modules Variables #############################:) + +(:~ + : ident:blocklevel-elements + : Variable defining Blocklevelelements by name + : + : @version 2.0 (2018-01-29) + : @author Uwe Sikora + :) +declare variable $ident:blocklevel-elements := ('titlePage', 'titlePart', 'aligned', 'div', 'list', 'item', 'table', 'row', 'cell', 'head', 'p', 'note'); + + +(:############################# Modules Functions #############################:) + +(:~ + : ident:in-sequence() + : This function checks if nodes are includes in a sequence of nodes + : + : @param $values the nodes to check against the sequence + : @param $sequence a sequence of AtomicTypes + : @return xs:boolean ('true' else 'false') + : + : @version 2.0 (2018-01-29) + : @status working + : @author Uwe Sikora + :) +declare function ident:in-sequence + ( $values as xs:anyAtomicType* , $sequence as xs:anyAtomicType*) as xs:boolean { + + $values = $sequence +}; + + +(:~ + : ident:is-or-are-ble() + : This function checks if nodes are Blocklevelelements + : + : @param $values the nodes to check against the sequence + : @return xs:boolean ('true' else 'false') + : + : @version 2.0 (2018-01-29) + : @note derived function from ident:in-sequence + : @status working + : @author Uwe Sikora + :) +declare function ident:is-or-are-ble + ( $values as xs:anyAtomicType* ) as xs:boolean { + + $values = $ident:blocklevel-elements +}; + + +(:~ + : ident:first-descendants-path() + : This recursive function describes the so called first-descendants PATH, + : that is the path of all save first nodes (1) not self a BLE and not including + : BLEs and (2) listen to defined parameters + : + : @param $node the nodes in the PATH from where all following nodes and thus the path itsel is defined + : @return set of node() representing the PATH + : + : @version 2.0 (2018-01-30) + : @status working + : @author Uwe Sikora + :) +declare function ident:first-descendants-path + ( $node as node()? ) as node()* { + + let $first-child := ( + let $target := $node/child::node()[1] + return + (: PATH CONTROLL for the last-descendants-path :) + + (: IN CASE there is an tei:app, be ready to change the path to + the first tei:rdg[ppl, ptl] and its first child::node()! :) + if ( $target[self::app] ) then ( + + (: If tei:app has an empty tei:lem change the path to tei:lems last child() :) + if ( empty($target/child::lem/node()) ) then ( + $target/child::rdg[@type eq "ppl" or @type eq "ptl"][1]/node()[1] + ) + + (: If tei:app has no empty tei:lem + follow the normal path from tei:app :) + else ( + $target + ) + ) + + (: If there is no tei:app proceed on normal path by default :) + else ( + $target + ) + ) + return + if($first-child) then ($first-child, ident:first-descendants-path($first-child)) else () +}; + + +(:~ + : ident:last-descendants-path() + : This recursive function describes the so called last-descendants PATH, + : that is the path of all save last nodes (1) not self a BLE and not including + : BLEs and (2) listen to defined parameters + : + : @param $node the nodes in the PATH from where all following nodes and thus the path itsel is defined + : @return set of node() representing the PATH + : + : @version 2.0 (2018-01-30) + : @status working + : @author Uwe Sikora + :) +declare function ident:last-descendants-path + ( $node as node()? ) as node()* { + + let $last-child := ( + let $target := $node/child::node()[last()] + return + (: PATH CONTROLL for the last-descendants-path :) + + (: IN CASE there is an tei:app, be ready to change the path ! :) + if ( $target[self::app] ) then ( + + (: If tei:apps last child is a tei:rdg[ppl, ptl] change the path to this rdg and + its last child() :) + if ( $target/child::node()[last()][ self::rdg[@type eq "ppl" or @type eq "ptl"] ] ) then ( + $target/child::node()[last()]/child::node()[last()] + ) + + (: If tei:app has no last child tei:rdg[ppl, ptl] and its tei:lem is not empty + change the path to tei:lems last child() :) + else if ( not(empty($target/child::lem/node())) ) then ( + $target/lem/child::node()[last()] + ) + + (: If tei:app has no last child tei:rdg[ppl, ptl] and its tei:lem is empty + follow the normal path from tei:app :) + else ( + $target + ) + ) + + (: If there is no tei:app proceed on normal path by default :) + else ( + $target + ) + ) + return + if($last-child) then ($last-child, ident:last-descendants-path($last-child)) else () +}; + + +(:~ + : ident:first-save-node() + : This function identifies the first-save node for a given node() + : + : @param $node the node of which the first save node should be identified + : @return the first save node of a defined set of save nodes + : + : @version 2.0 (2018-01-30) + : @status working + : @author Uwe Sikora + :) +declare function ident:first-save-node + ( $node as node() ) as node()* { + + let $first := ident:first-descendants-path($node) + [not ( ident:is-or-are-ble(self::node()/name()) )] + [not ( ident:is-or-are-ble( ident:first-descendants-path(self::node())/name() ) )] + + return $first[1] +}; + + +(:~ + : ident:last-save-node() + : This function identifies the last-save node for a given node() + : + : @param $node the node of which the last save node should be identified + : @return the last save node of a defined set of save nodes + : + : @version 2.0 (2018-01-30) + : @status working + : @author Uwe Sikora + :) +declare function ident:last-save-node + ( $node as node() ) as node()* { + + let $last := ident:last-descendants-path($node) + [not ( ident:is-or-are-ble(self::node()/name()) )] + [not ( ident:is-or-are-ble( ident:last-descendants-path(self::node())/name() ) )] + + return $last[1] +}; + + +(:~ + : ident:identify-targets() + : This function identifies the first and last save node for a given reading (tei:lem and tei:rdg) + : It also collect the sibling readings as shortcuts (name and attributes) to build a set + : of reading markers for opening and closing Markers + : + : @param $node the reading nodegoing to be evaluated + : @return evaluation report for the node acording to the following form + : - element "rdg" or "lem" incl. copied attributes + : - element "target"[@type = "open"] incl. @id (generated) + : - element "target"[@type = "close"] incl. @id (generated) + : - element "marker"[@type = "open"] incl. @id (generated) + : - element "marker"[@type = "close"] incl. @id (generated) + : + : @version 2.0 (2018-01-31) + : @status working + : @author Uwe Sikora + :) +declare function ident:identify-targets + ( $node as node() ) as node()* { + + let $first := ident:first-save-node($node) + let $last := ident:last-save-node($node) + let $marker-set := markerset:collect-markers($node) + let $markers := markerset:construct-marker-from-markerset("rdgMarker", "open", $marker-set) + + return + element {$node/name()}{ + $node/@*, + element {"target"}{ + attribute {"type"}{ "open" }, + attribute {"gid"}{ generate-id($first) }(:, + $first:) + }, + element {"target"}{ + attribute {"type"}{ "close" }, + attribute {"gid"}{ generate-id($last) }(:, + $last:) + }, + element {"marker"}{ + attribute {"type"}{ "open" }, + markerset:construct-marker-from-markerset("rdgMarker", "open", $marker-set) + }, + element {"marker"}{ + attribute {"type"}{ "close" }, + reverse( markerset:construct-marker-from-markerset("rdgMarker", "close", $marker-set) ) + } + } +}; + + +(:~ + : ident:walk() + : This recursive function represents the main conversion which adds the reading markers + : for tei:lem and tei:rdg nodes + : + : @param $nodes nodes to be converted + : @param $reading-sequence sequence holding the evaluation reports of the relevant readings in the nodes' context + : @return converted node + : + : @version 2.0 (2018-02-01) + : @status working + : @author Uwe Sikora + :) +declare function ident:walk + ( $nodes as node()*, $reading-sequence as item()* ) as item()* { + + for $node in $nodes + return + typeswitch($node) + case processing-instruction() return () + case text() return ( + if (normalize-space($node) eq "") then () else ( + ident:mark-node($node, $reading-sequence) + ) + ) + + case element(rdg) return ( + if ( not($node/parent::app[ @type eq "structural-variance" ]) ) then ( + let $identified-targets := ident:identify-targets($node) + return ident:mark-node( $node, ($reading-sequence, ident:identify-targets($node)) ) + ) else ( + ident:mark-node($node, $reading-sequence) + ) + ) + + case element(lem) return ( + if ( not($node/parent::app[ @type eq "structural-variance" ]) ) then ( + let $identified-targets := ident:identify-targets($node) + return ident:mark-node( $node, ($reading-sequence, ident:identify-targets($node)) ) + ) else ( + ident:mark-node($node, $reading-sequence) + ) + ) + + default return ( + ident:mark-node($node, $reading-sequence) + ) +}; + + +(:~ + : ident:mark-node() + : This function checks if a given node is a identified first or last save node + : and sets in case of positive identification sets opening and closing markers before and after the node + : + : @param $nodes nodes to be checked and in case of positive identification decorated with markers + : @param $reading-sequence sequence holding the evaluation reports of the relevant readings in the nodes' context + : @return converted node() + : + : @version 2.0 (2018-02-01) + : @status working + : @author Uwe Sikora + :) +declare function ident:mark-node + ( $node as node(), $reading-sequence as item()* ) as node()* { + + let $node-id := generate-id( $node ) + let $in-reading-sequence := $reading-sequence//target[@gid eq $node-id] + return + if ($in-reading-sequence) then ( + let $marker := ident:fetch-marker-from-sequence($node-id, $reading-sequence) + let $open := $marker[@type = "open"]/node() + let $close := (for $item in reverse($marker[@type = "close"]) return $item/node()) + return( + $open, + if ( $node[ not(self::text()) ] ) then ( + element{$node/name()}{ + $node/@*, + ident:walk($node/node(), $reading-sequence) + } + ) else ( + $node + ), + $close + ) + ) else ( + if ( $node[ not(self::text()) ] ) then ( + element{$node/name()}{ + $node/@*, + ident:walk($node/node(), $reading-sequence) + } + ) else ( + $node + ) + ) +}; + + +(:~ + : ident:mark-text() + : This function checks if a given text() is a identified first or last save node + : and sets in case of positive identification sets opening and closing markers before and after the node + : + : @param $nodes nodes to be checked and in case of positive identification decorated with markers + : @param $reading-sequence sequence holding the evaluation reports of the relevant readings in the nodes' context + : @return converted node() + : + : @version 2.0 (2018-02-01) + : @status deprecated. integrated in ident:mark-node() + : @author Uwe Sikora + :) +(:declare function ident:mark-text + ($node as node(), $reading-sequence as item()* ) as node()* { + + let $node-id := generate-id( $node ) + let $in-reading-sequence := $reading-sequence//target[@gid eq $node-id] + return + if ($in-reading-sequence) then ( + let $marker := ident:fetch-marker-from-sequence($node-id, $reading-sequence) + let $open := $marker[@type = "open"]/node() + let $close := (for $item in reverse($marker[@type = "close"]) return $item/node()) + return( + $open, $node, $close + ) + ) else ( $node ) +};:) + + +(:~ + : ident:fetch-marker-from-sequence() + : Helperfunction to collect the reading markers from a given reading sequence + : + : @param $node-id id to be checked against the reading-sequences target-ids + : @param $reading-sequence sequence holding the evaluation reports of the relevant readings in the nodes' context + : @return reading markers as node()* for the node associated with node-id + : + : @version 2.0 (2018-02-01) + : @status working + : @author Uwe Sikora + :) +declare function ident:fetch-marker-from-sequence + ($node-id as xs:string, $reading-sequence as item()* ) as node()* { + + for $seq-item in $reading-sequence + let $found := $seq-item/target[@gid = $node-id] + let $found-type := $found/string(@type) + let $markers := $seq-item/marker[@type = $found-type] + where $found + return + $markers +}; + + + +(:~ + : ident:identify-unit-test() + : Some kind of test-unit-function to eval the main identification functionality of this module on all tei:lem and tei:readings of a given xml-tree + : + : @param $nodes xml-tree to be tested + : @return test report for each tei:lem and tei:reading as node()* + : + : @version 2.0 (2018-02-01) + : @status working + : @note meant to test the identification algorithm + : @author Uwe Sikora + :) +declare function ident:identify-unit-test + ( $nodes as node()* ) as node()* { + + for $node at $nr in $nodes//node()[self::lem or self::rdg] + let $identified-targets := ident:identify-targets($node) + return + element{"UTEST"}{ + attribute {"n"}{$nr}, + element {"SELF"} {$node}, + $identified-targets + } +}; \ No newline at end of file diff --git a/modules/intermediate_format/markerset.xqm b/modules/intermediate_format/markerset.xqm new file mode 100644 index 0000000000000000000000000000000000000000..a25714693780e436ea5098b295df9adb082001d3 --- /dev/null +++ b/modules/intermediate_format/markerset.xqm @@ -0,0 +1,139 @@ +xquery version "3.0"; +(:~ + : MARKERSET Module ("markerset", "http://bdn.edition.de/intermediate_format/markerset") + : ******************************************************************************************* + : This module is a helper module and defines functions to collect and construct reading markers + : + : @version 2.0 (2018-01-29) + : @status working + : @author Uwe Sikora + :) +module namespace markerset="http://bdn.edition.de/intermediate_format/markerset"; +declare default element namespace "http://www.tei-c.org/ns/1.0"; + + +(:############################# Modules Functions #############################:) + +(:~ + : markerset:collect-markers() + : This function collect markers for a given reading. + : It destinguishes tei:lem and tei:rdg. In case of tei:lem it collects all sibling tei:rdgs. In case of tei:rdg it collect itself. + : + : @param $reading the reading node to collect readings for + : @return node() representing a markerset of readings for the given node + : + : @version 2.0 (2018-01-29) + : @status working + : @author Uwe Sikora + :) +declare function markerset:collect-markers + ( $reading as node()* ) as item() { + + let $markers := ( + if ($reading[self::lem]) then ( + attribute {"count"}{count($reading/following-sibling::rdg)}, + for $sibling in $reading/following-sibling::rdg + return( + element {name($sibling)} { + $sibling/@*, + attribute {"context"}{"lem"} + } + ) + ) + else if ($reading[self::rdg]) then ( + element {name($reading)} { + $reading/@*, + attribute {"context"}{"rdg"} + } + ) + else () + ) + return + element {"markerset"}{ + markerset:merge-markers($markers) + (:$markers:) + } +}; + + +(:~ + : markerset:merge-markers() + : This function merges markers in a given set by the same type. It orders the merged markers according to an explicit ordering. + : + : @param $markerset node() including the markers that should be merged + : @return node()* representing the merged markerset + : + : @version 2.0 (2018-01-29) + : @status working + : @author Uwe Sikora + :) +declare function markerset:merge-markers + ( $markerset as node()* ) as item()* { + + let $order := ("om","ppl", "ptl", "pp", "pt" , "v") + let $reading-types := distinct-values( $markerset[self::rdg or self::lem]/string(@type) ) + + return ( + attribute {"order"}{distinct-values( ($order, $reading-types) ) }, + for $type in distinct-values( ($order, $reading-types) ) + let $rdgs := $markerset[@type = $type] + return + if ($rdgs) then ( + element {"rdg"}{ + attribute wit {$rdgs/@wit}, + attribute id {$rdgs/@id}, + attribute context {distinct-values($rdgs/@context)}, + attribute type {$type} + } + ) else () + + ) +}; + + +(:~ + : markerset:marker() + : Constructor function which creates the marker element with name, mark-type and references + : + : @param $name The name of the marker element + : @param $mark The mark type e.g. open or close + : @param $rdg_node The node which is marked + : @return element() the marker element + : + : @version 1.1 (2017-09-13) + : @author Uwe Sikora + :) +declare function markerset:marker + ($name as xs:string, $type as xs:string, $reading as node()) as element(){ + + element {$name} { + (:attribute bdnp_parent {$node/parent::node()/name()}, :) + attribute wit { replace(data($reading/@wit), '#', '') }, + attribute type { data($reading/@type) }, + attribute ref { data($reading/@id) }, + attribute mark { $type }, + attribute context { $reading/@context } + } +}; + + +(:~ + : markerset:construct-marker-from-markerset + : Helping function to construct markers for a sequence of markersets + : + : @param $name The name of the marker element + : @param $marker-type The mark type e.g. open or close + : @param $marker-set The markersets for which reading markers shall be coonstructed + : @return item()* representing the constructed rdgMarker sets + : + : @version 1.0 (2018-02-29) + : @author Uwe Sikora + :) +declare function markerset:construct-marker-from-markerset + ( $name as xs:string, $marker-type as xs:string, $marker-set as node()* ) as item()* { + + for $marker in $marker-set/node() + return ( + markerset:marker($name, $marker-type, $marker) + ) +}; \ No newline at end of file diff --git a/modules/intermediate_format/preprocessing.xqm b/modules/intermediate_format/preprocessing.xqm new file mode 100644 index 0000000000000000000000000000000000000000..1e7995537c0820394b6dc8ca7f46ce09c79c7e1e --- /dev/null +++ b/modules/intermediate_format/preprocessing.xqm @@ -0,0 +1,246 @@ +xquery version "3.0"; +(:~ + : PREPROCESSING Module ("pre", "http://bdn.edition.de/intermediate_format/preprocessing") + : ******************************************************************************************* + : This module contains the preprocessing routines for the intermediate format + : + : It imports the whitespace handling helper module to make some whitespace handling duricng the preprocessing + + : @version 2.0 (2018-01-29) + : @status working + : @author Uwe Sikora + :) +module namespace pre="http://bdn.edition.de/intermediate_format/preprocessing"; +import module namespace whitespace = "http://bdn.edition.de/intermediate_format/whitespace_handling" at "whitespace-handling.xqm"; + +declare default element namespace "http://www.tei-c.org/ns/1.0"; + + +(:############################# Modules Functions #############################:) + +(:~ + : pre:preprocessing-textNode + : preprocessing function which converts each text() into a xml-node "textNode". This function is a experimental fall back solution and not the main preprocessing routine! + : + : @param $nodes the nodes to be converted + : @return item()* representing the converted node + : + : @version 1.2 (2017-10-15) + : @status working + : @author Uwe Sikora + :) +declare function pre:preprocessing-textNode + ($nodes as node()*) as item()* { + + for $node in $nodes + return + typeswitch($node) + case processing-instruction() return () + case text() return ( + if (normalize-space($node) eq "") then () else ( + element {"textNode"} { + (:attribute {"interformId"}{ generate-id($node) },:) + $node + } + ) + ) + + case element(TEI) return ( + element{$node/name()}{ + $node/@*, + pre:preprocessing-textNode($node/node()), + element{"editorialNotes"}{ + $node//note[@type eq "editorial"] + } + } + ) + + case element(lem) return ( + element{$node/name()}{ + $node/@*, + attribute {"id"}{ generate-id($node)}, + pre:preprocessing-textNode($node/node()) + } + ) + + case element(rdg) return ( + element{$node/name()}{ + $node/@*, + attribute {"id"}{ generate-id($node)}, + pre:preprocessing-textNode($node/node()) + } + ) + + case element(note) return ( + if ($node[@type eq "editorial"]) then ( + ) else ( + element{$node/name()}{ + $node/@*, + pre:preprocessing-textNode($node/node()) + } + ) + ) + + default return ( + element{$node/name()}{ + $node/@*, + pre:preprocessing-textNode($node/node()) + } + ) +}; + + +(:~ + : pre:pre:default-element + : function that suites as default element constructor for the preproseccing conversion. + : It is more or less a copy function, copying the elements name and its node and recurively leeds the conversion to its child-nodes + : + : @param $node the node to be copied + : @param $recursive-function the recursive function as some kind of call back to the main conversion + : @return item()* representing the converted node + : + : @version 1.0 (2018-01-31) + : @note Would be great if $recursive-function would be a real function and not a node-sequence (TO-DO) + : @status working + : @author Uwe Sikora + :) +declare function pre:default-element + ( $node as node(), $recursive-function as node()* ) as item()* { + + element{$node/name()}{ + $node/@*, + $recursive-function + } +}; + + +(:~ + : pre:preprocessing + : main preprocessing function. + : + : @param $nodes the nodes to be converted + : @return item()* representing the converted node + : + : @version 2.0 (2018-02-01) + : @status working + : @author Uwe Sikora + :) +declare function pre:preprocessing + ($nodes as node()*) as item()* { + + for $node in $nodes + return + typeswitch($node) + case processing-instruction() return () + + case text() return ( + whitespace:text($node, " ") + ) + + case comment() return () + + case element(TEI) return ( + element{$node/name()}{ + $node/@*, + pre:preprocessing($node/node()), + element{"editorialNotes"}{ + for $editorial-note in $node//note[@type eq "editorial"] + return + pre:default-element( $editorial-note, pre:preprocessing($editorial-note/node()) ) + } + } + ) + + case element(teiHeader) return ( + element {name($node)} { + $node/@*, + $node/node() + } + ) + + case element(div) return ( + if ($node[@type = 'section-group']) then ( + pre:preprocessing($node/node()) + ) + else ( + pre:default-element( $node, pre:preprocessing($node/node()) ) + ) + + ) + + case element(lem) return ( + element{$node/name()}{ + $node/@*, + attribute {"id"}{ generate-id($node)}, + pre:preprocessing($node/node()) + } + ) + + case element(rdg) return ( + element{$node/name()}{ + $node/@*, + attribute {"id"}{ generate-id($node)}, + pre:preprocessing($node/node()) + } + ) + + case element(note) return ( + if ( $node[@type != "editorial"] ) then ( + pre:default-element( $node, pre:preprocessing($node/node()) ) + ) else ( ) + ) + + case element(pb) return ( + let $preceeding-sibling := $node/preceding-sibling::node()[1] + let $following-sibling := $node/following-sibling::node()[1] + return + element {$node/name()}{ + $node/@*, + if ( ends-with($preceeding-sibling, " ") eq false() and starts-with($following-sibling, " ") eq false() ) then ( + attribute {"break"}{"no"} + ) else ( )(:, + attribute {"whitespace"}{ + if (ends-with($preceeding-sibling, " ")) then ( + "before" + ) else (), + if (starts-with($following-sibling, " ")) then ( + "after" + ) else () + }:) + } + ) + + case element(hi) return ( + if($node[@rend = 'right-aligned' or @rend = 'center-aligned']) then( + element {'aligned'} { + $node/@*, + pre:preprocessing($node/node()) + } + ) + else ( + pre:default-element( $node, pre:preprocessing($node/node()) ) + ) + ) + + case element(seg) return ( + if($node[@type = 'item']) then( + element {'item'} { + $node/@*[name() != 'type'], + pre:preprocessing($node/node()) + } + ) + else if($node[@type = 'row']) then( + element {'row'} { + $node/@*[name() != 'type'], + pre:preprocessing($node/node()) + } + ) + else ( + pre:default-element( $node, pre:preprocessing($node/node()) ) + ) + ) + + default return ( + pre:default-element( $node, pre:preprocessing($node/node()) ) + ) +}; \ No newline at end of file diff --git a/modules/intermediate_format/whitespace-handling.xqm b/modules/intermediate_format/whitespace-handling.xqm new file mode 100644 index 0000000000000000000000000000000000000000..66539a4a3050e5c65eb9e245a7fb9384cebdb6b1 --- /dev/null +++ b/modules/intermediate_format/whitespace-handling.xqm @@ -0,0 +1,66 @@ +xquery version "3.0"; +(:~ + : WHITESPACE Module ("whitespace", "http://bdn.edition.de/intermediate_format/whitespace_handling") + : ******************************************************************************************* + : This module contains the functions to handle different whitespace operations on text + : + : @version 1.0 (2018-01-02) + : @status working + : @author Uwe Sikora + :) +module namespace whitespace="http://bdn.edition.de/intermediate_format/whitespace_handling"; +declare default element namespace "http://www.tei-c.org/ns/1.0"; + + +(:############################# Modules Functions #############################:) + +(:~ + : whitespace:text() + : This function handles whitespace in defined text() nodes + : + : @param $text the text-node to be converted + : @param $escape-char a optional escape-character replacing all whitespace characters + : @return text()* representing the escaped text() + : + : @version 2.0 (2018-01-30) + : @status working + : @author Uwe Sikora + :) +declare function whitespace:text + ( $text as text()*, $escape-char as xs:string? ) as text()* { + + let $normalized := normalize-space($text) + let $single-whitespace-between-nodes := $text + [ self::node() = ' '] + [preceding-sibling::node()[not(self::node() = text())]] + [following-sibling::node()[not(self::node() = text())]] + return + if ( $normalized != "" or $single-whitespace-between-nodes) then ( + + if ($escape-char) then ( + whitespace:escape-text($text, $escape-char) + ) else ( whitespace:escape-text($text, " ") ) + + ) + else () +}; + + +(:~ + : whitespace:escape-text() + : This function replaces whitespaces in a text() + : with a defined preservation character + : + : @param $text the text-node to be converted + : @param $escape the escape-character replacing all whitespace characters + : @return text()* representing the escaped text() + : + : @version 2.0 (2018-01-30) + : @status working + : @author Uwe Sikora + :) +declare function whitespace:escape-text + ( $text, $escape as xs:string ) as text()* { + + text {replace($text, '[\s]+', $escape)} +}; diff --git a/oxygen/devel/data/samples.xml b/oxygen/devel/data/samples.xml new file mode 100644 index 0000000000000000000000000000000000000000..12efea8e6eabce1c3cb9a0aa88af2f82f725bac9 --- /dev/null +++ b/oxygen/devel/data/samples.xml @@ -0,0 +1,614 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?> +<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" + schematypens="http://purl.oclc.org/dsdl/schematron"?> +<TEI xmlns="http://www.tei-c.org/ns/1.0"> + <teiHeader xml:id="noe_header"> + <!-- Dateibeschreibung --> + <fileDesc> + <!--Titelbeschreibung --> + <titleStmt> + <title level="s"> + <title type="main">Bibliothek der Neologie (BdN)</title> + <title type="sub">Kommentierte kritische Auswahledition in zehn Bänden</title> + </title> + <title level="a">BdN VI: Johann August Nösselt, Anweisung zur Bildung angehender + Theologen (1. Aufl. 1786/89; 2. Aufl. 1791; 3. Aufl. 1818/19)</title> + <author> + <persName><ref target="#textgrid:24gvc">Nösselt, Johann August</ref></persName> + </author> + <principal> + <persName>Beutel, Albrecht</persName> + </principal> + <respStmt> + <resp from="2015-04">Informationswissenschaftliche und -technologische + Leitung</resp> + <persName>Blümm, Mirjam</persName> + </respStmt> + <respStmt> + <resp key="former" from="2014-04" to="2015-03">Informationswissenschaftliche und + -technologische Leitung</resp> + <persName>Neuroth, Heike</persName> + </respStmt> + <editor> + <persName>Lemitz, Bastian</persName> + <persName>Söntgerath, Olga</persName> + </editor> + <respStmt> + <resp>Editorische Mitarbeit</resp> + <persName>Figgen, Larissa</persName> + <persName>Huck, Johannes</persName> + <persName>Stallmann, Marco</persName> + </respStmt> + <respStmt> + <resp key="former" from="2014-05" to="2016-09">Editorische Mitarbeit</resp> + <persName>Goormann, Lena</persName> + </respStmt> + <respStmt> + <resp key="former" from="2014-05" to="2015-09">Editorische Mitarbeit</resp> + <persName>Meier, Lars-Steffen</persName> + </respStmt> + <respStmt> + <resp>TEI-Schema und Metadaten</resp> + <persName>Sikora, Uwe</persName> + </respStmt> + <respStmt> + <resp from="2015-10">Visualisierung und Portal</resp> + <persName>Rodzis, Michelle</persName> + </respStmt> + <respStmt> + <resp key="former" from="2014-05" to="2015-09">Visualisierung und Portal</resp> + <persName>Riebl, Hannes</persName> + </respStmt> + <respStmt> + <resp from="2015-10">Serverpflege</resp> + <persName>Veentjer, Ubbo</persName> + </respStmt> + <sponsor>Deutsche Forschungsgemeinschaft (DFG)</sponsor> + </titleStmt> + + <!-- Editionsbeschreibung --> + <editionStmt> + <edition>Johann August Nösselt, Anweisung zur Bildung angehender Theologen (1. Aufl. + 1786/89; 2. Aufl. 1791; 3. Aufl. 1818/19), hg. v. Albrecht Beutel, Bastian + Lemitz u. Olga Söntgerath (BdN VI), <date>2017</date> + </edition> + </editionStmt> + + <!-- Größe und Umfang des digitalen Dokuments --> + <extent> + <measure unit="MB" quantity="123">xxx MB</measure> + <measure unit="pages" quantity="234">xxx Seiten</measure> + </extent> + + <!-- Publikationsbeschreibung --> + <publicationStmt> + <publisher>DFG-Projekt "Bibliothek der Neologie. Kommentierte kritische + Auswahledition in zehn Bänden", Seminar für Kirchengeschichte II, + Evangelisch-Theologische Fakultät, Westfälische Wilhelms-Universität + Münster</publisher> + <publisher>Niedersächsische Staats- und Universitätsbibliothek Göttingen, + Abteilungen: Forschung und Entwicklung, Informations- und Literaturversorgung + Zentrale Erwerbung und Erschließung (Gruppe Metadaten und + Datenkonversion)</publisher> + <distributor> + <persName>Beutel, Albrecht</persName> + <persName>Söntgerath, Olga</persName> + </distributor> + <authority> + <persName>Blümm, Mirjam</persName> + </authority> + <date>2017</date> + <availability status="free"> + <licence target="https://creativecommons.org/licenses/by-sa/3.0/legalcode"> + <p>Creative Commons Attribution-ShareAlike 3.0 Unported License</p> + </licence> + </availability> + </publicationStmt> + + <!-- Reihenbeschreibung --> + <seriesStmt> + <title level="s"> + <title type="main">Bibliothek der Neologie (BdN)</title> + <title type="sub">Kommentierte kritische Auswahledition in zehn Bänden</title> + </title> + <title level="a"><title type="main">BdN VI: Johann August Nösselt, Anweisung zur + Bildung angehender Theologen (1. Aufl. 1786/89; 2. Aufl. 1791; 3. Aufl. + 1818/19)</title> + <title type="condensed">Nösselt, Anweisung zur Bildung angehender Theologen <hi rend="superscript">1</hi>1786/89–<hi rend="superscript">3</hi>1818/19</title></title> + <respStmt> + <resp>Reihenherausgeber</resp> + <persName>Beutel, Albrecht</persName> + <persName>Söntgerath, Olga</persName> + </respStmt> + <respStmt> + <resp>Bandherausgeber</resp> + <persName>Beutel, Albrecht</persName> + <persName>Lemitz, Bastian</persName> + <persName>Söntgerath, Olga</persName> + </respStmt> + </seriesStmt> + + <!-- Quellenbeschreibung --> + <sourceDesc> + <listWit> + <witness xml:id="a"> + <desc>1. Aufl. 1786/89</desc> + <bibl>Anweisung zur Bildung angehender Theologen. von D. Johann August + Nösselt. Erster Theil. Halle, bey Joh. Jac. Curts Wittwe, 1786, [XVI], + 1–288 S.; Zweyter Theil, 1786, [IV], 289–580 S.; Dritter und letzter + Theil, 1789, [XII], 581–824 S. Vorlage: Universitäts- und + Landesbibliothek Sachsen-Anhalt, Signatur: Ia 1630 (Hefte 1–3), + Standort: Ha 179.</bibl> + </witness> + <witness xml:id="b"> + <desc type="base-text">2. Aufl. 1791</desc> + <bibl>Anweisung zur Bildung angehender Theologen, von D. Johann August + Nösselt. Erster Band. Zweyte vermehrte und verbesserte Auflage. Halle, + bey Joh. Jac. Curts Wittwe, 1791, [XXVIII], 340 S.; Zweyter Band, 1791, + 320 S.; Dritter und letzter Band, 1791, 256 S. Vorlage: + Evangelisch-Theologische Seminare der Westfälischen Wilhelms-Universität + Münster, Signatur: 8: 2007/4.</bibl> + </witness> + <witness xml:id="c"> + <desc>3. Aufl. 1818/19</desc> + <bibl>Anweisung zur Bildung angehender Theologen, von Johann August Nösselt, + weil. Königl. Preußischem Geheimderath, Doctor und Professor der + Theologie zu Halle. Herausgegeben und mit Anmerkungen, literarischen + Zusätzen und Ergänzungen begleitet von D. August Hermann Niemeyer, + Königl. Preuß. Oberkonsistorialrath, Kanzler und Professor der Theologie + auf der vereinigten Friedrichsuniversität Halle und Wittenberg, Director + der Frankischen Stiftungen, auch Ritter des rothen Adlerordens dritter + Klasse. Erster Band. Dritte Auflage. Halle, im Verlage der Curtschen + Buchhandlung, 1818, XXX, 303 S.; Zweiter Band, 1818, VIII, 275 S.; + Dritter Band, 1819, X, 228 S. Vorlage: Staatsbibliothek zu Berlin – + Preußischer Kulturbesitz, Signatur: Bc 1266 1–3.</bibl> + </witness> + </listWit> + </sourceDesc> + </fileDesc> + + <!-- Beschreibung der Editionsrichtlinien --> + <encodingDesc> + <projectDesc> + <p>DFG-Projekt "Bibliothek der Neologie. Kommentierte kritische Auswahledition in + zehn Bänden", Seminar für Kirchengeschichte II, Evangelisch-Theologische + Fakultät, Westfälische Wilhelms-Universität Münster</p> + </projectDesc> + <editorialDecl> + <p>Eine umfassende Beschreibung der Editionsrichtlinien siehe <ref target="http://www.bdn-edition.de/editionsrichtlinien.html">http://www.bdn-edition.de/editionsrichtlinien.html</ref>.</p> + <p>Dieses Dokument ist an das BdN-Verweisnetz angebunden, welches bibliographische + und Personendaten nach dem "Resource Description Framework" (RDF) zur Verfügung + stellt. Nähere Informationen dazu sind in Kapitel 4 der o.g. Richtlinien zu + finden.</p> + </editorialDecl> + </encodingDesc> + <!--<styleDefDecl scheme="css" schemeVersion="2.1"/> + <variantEncoding method="parallel-segmentation" location="internal"/>--> + + <!-- Profilbeschreibung, ggf. ergänzen --> + + + <revisionDesc> + <change when="2014-05-12">Beginn: Transkription der Leitauflage im Word-Format.</change> + <change when="2014-06-03">Beginn der ersten Korrekturphase durch abgleichende Lektüre + des Leittextes aus Word-Dateien mit dem Original.</change> + <change when="2014-07-07">Ende: Transkription der Leitauflage im Word-Format.</change> + <change when="2014-07-09">Datenkonversion ins XML-Format. Der Textbestand liegt zunächst + in Einzelsegmenten von ca. 20-30 Originalseiten vor, um die zeitgleiche Arbeit + mehrerer Personen an den Dokumenten zu ermöglichen.</change> + <change when="2014-07-31">Ende: Erste Korrekturphase des Leittextes. Fehlerkorrektur im + XML-Editor.</change> + <change when="2014-08-11">Auszeichnung Textstruktureinheiten (Kapitel, Paragraphen, + Überschriften, Absätze, Annotationen und ihre Verknüpfung mit dem Fließtext, + Aufzählungen, Seitenumbrüche), graphischer Hervorhebungen des Textes (Kursivdruck), + Sprache (Griechisch, Hebräisch) sowie Sonderzeichen. Erste + Markup-Kontrolle.</change> + <change when="2014-08-27">Auszeichnung und Auflösung von Abkürzungen und Druckfehlern; + Überprüfung von Sonderzeichen.</change> + <change when="2014-08-28">Beginn der zweiten Korrekturphase durch abgleichende Lektüre + des Leittextes aus der XHTML-Ansicht im Projektportal mit dem Original.</change> + <change when="2014-10-27">Anpassung der Auszeichnung, insbesondere Typisierung von + Annotationen (authorial/editorial), Präzisierung der XML-ID-Vergabe, Referenzierung + von Seitenwechsel.</change> + <change when="2014-12-04">Ende der zweiten Korrekturphase.</change> + <change when="2014-12-16">Beginn: Kollation aller Auflagen, Auszeichnung des + textkritischen Apparates (Textkritik) nach der Double-Endpoint-Methode.</change> + <change when="2015-04-20">Wechsel zu der Parallel-Segmentation-Methode in der + Auszeichnung der Textkritik wegen unzureichender Prozessierbarkeit der Daten. + Implementierung einer Korrekturansicht im TextGrid-Lab zur sofortigen Überprüfung + der Textkritik-Auszeichnung. Verknüpfung aller Dateien mit CSS und XSLT. Kontrolle + der Textkritikauszeichnung nach einer maschinellen Überführung der bereits + ausgezeichneten Daten in die Parallel-Segmentation-Methode und deren Anpassung + aufgrund eines geringfügigen Informationsverlusts.</change> + <change when="2015-06-04">Korrekturlektüre des Textausschnittes für die Modelledition + aus der Printversion.</change> + <change when="2015-08-01">Beginn: Anlegen der RDF-Objekte (Personen, bibliographische + Angaben). Beginn: editorische Erläuterungen.</change> + <change when="2015-08-13">Ende: Kollation aller Auflagen und + Textkritikauszeichnung.</change> + <change when="2015-09-03">Verlinkung der Querverweise im Text und zu den + Inhaltsverzeichnissen sowie zu den Corrigendalisten in allen Auflagen.</change> + <change when="2015-09-15">Anlegen der Hauptdatei, die alle Einzeldateien includiert. + Anbinden aller Texte aus den Einzeldateien an die Hauptdatei.</change> + <change when="2015-10-01">Differenzierte Anlage der Metadaten im Header der Hauptdatei + und kontinuierliche Metadatenpflege.</change> + <change when="2015-11-02">Verlinkung zu den autorschaftlichen Annotationen in allen + Auflagen.</change> + <change when="2015-11-15">Beginn: Anbinden der RDF-Objekte und gleichzeitige + Auszeichnung des Personenregisters und des Registers Antiker Autoren im ersten + Teilband.</change> + <change when="2015-12-01">Beginn: Auszeichnung variierender Strukturen der + Einzelauflagen (Strukturkritik). Kontrolle der Strukturkritikauszeichnung mithilfe + von Ansichten der Einzelauflagen im Projektportal.</change> + <change when="2016-02-15">Korrekturlektüre des Textausschnittes für die Modelledition + aus der druckähnlichen textkritischen Ansicht im Projektportal.</change> + <change when="2016-02-16">Korrekturlektüre des Textausschnittes für die Modelledition + aus den Einzelansichten aller Auflagen im Projektportal.</change> + <change when="2016-04-18">Beginn der ersten Korrekturphase der Textkritikauszeichnung + des gesamten Bandes.</change> + <change when="2016-05-03">Beginn: semantische Bibelstellenauszeichnung und gleichzeitige + Bibelstellenindexierung.</change> + <change when="2016-05-09">Anpassung der Listenauszeichnung.</change> + <change when="2016-05-30">Kontrolle der Metadaten im Header.</change> + <change when="2016-05-31">Erneute Korrekturlektüre des Textausschnittes für die + Modelledition aus der Printversion.</change> + <change when="2016-06-29">Veröffentlichung der Modelledition am Beispiel der Paragraphen + 140-150 des ersten Teilbandes.</change> + <change when="2016-09-08">Ende der ersten Korrekturphase der Textkritikauszeichnung des + gesamten Bandes. Gleichzeitige Anpassung der Textkritikauszeichnung.</change> + <change when="2016-10-01">Ende: semantische Bibelstellenauszeichnung und gleichzeitige + Bibelstellenindexierung.</change> + <change when="2016-10-17">Beginn: Kontrolle der Satzfehlerauszeichnung.</change> + <change when="2016-10-25">Beginn: Überprüfen der Querverweise im Text in ihrer + inhaltlichen Richtigkeit.</change> + <change when="2016-11-04">Ende: Überprüfen der Querverweise im Text in ihrer + inhaltlichen Richtigkeit.</change> + <change when="2016-11-07">Beginn: Anbinden der RDF-Objekte und gleichzeitige + Auszeichnung des Personenregisters und des Registers Antiker Autoren im dritten + Teilband.</change> + <change when="2016-11-25">Überführen der Seitenumbrüche in die + Block-Level-Elemente.</change> + <change when="2016-12-09">Anreicherung der Kapitel-Elemente auf allen hierarchischen + Ebenen mit XML-ID.</change> + <change when="2016-12-14">Ende: Anbinden der RDF-Objekte und gleichzeitiges Auszeichnen + des Personenregisters und des Registers Antiker Autoren im dritten + Teilband.</change> + <change when="2016-12-21">Inhaltliche Überprüfung der Berichtigung von Satzfehlern im + gesamten Band.</change> + <change when="2017-02-01">Beginn: Auswahl einschlägiger Begriffe für das Sachregister + und gleichzeitiges Auszeichnen des Sachregisters.</change> + <change when="2017-02-02">Korrektur des Bibelstellenregisters aus der ersten Printfahne, + Korrektur der Auszeichnung.</change> + <change when="2017-03-06">Ende: Auszeichnen des Sachregisters.</change> + <change when="2017-03-07">Wiederholte Kontrolle der Strukturkritikumsetzung mithilfe von + Ansichten der Einzelauflagen im Projektportal.</change> + <change when="2017-04-03">Kontrolle der Funktionalität der RDF-Objekte und deren + Anbindung an die Daten über die interaktive Ansicht im Projektportal.</change> + <change when="2017-05-15">Erste Printkontrolle des gesamten Bandes.</change> + <change when="2017-05-25">Kontextualisierende inhaltliche Einleitung erarbeitet und + korrigiert.</change> + <change when="2017-06-26">Auszeichnen der kontextualisierenden inhaltlichen + Einleitung.</change> + <change when="2017-07-13">Auszeichnung der Kolumnentitel für den Print.</change> + <change when="2017-08-24">Beginn: Anbinden der RDF-Objekte und gleichzeitiges + Auszeichnen des Personenregisters und des Registers Antiker Autoren im zweiten + Teilband.</change> + </revisionDesc> + </teiHeader> + <text> + <body> + <div n="0"> + <app> + <lem> + <titlePage> + <titlePart type="main"><pb edRef="#b" type="sp" n="I"/> + <choice> + <orig>Anweisung <lb/>zur <lb/>Bildung <lb/>angehender + Theologen,</orig> + <seg type="toc-item">Anweisung zur Bildung angehender + Theologen</seg> + </choice></titlePart> + <lb/> + <byline>von <lb/><docAuthor><choice> + <abbr>D.</abbr> + <expan>Doctor</expan> + </choice> + <index indexName="persons"> + <term>Nösselt, Johann August</term> + </index><persName ref="#textgrid:24gvc">Johann August + Nösselt</persName></docAuthor>.</byline> + <lb/> + <titlePart type="volume"><choice> + <orig>Erster Band.</orig> + <seg type="toc-item">Erster Band</seg> + </choice></titlePart> + <lb/> + <docEdition>Zweyte vermehrte und verbesserte Auflage.</docEdition> + <lb/> + <docImprint>Halle, <lb/>bey <index indexName="persons"> + <term>Curt, Johann Jacob</term> + </index><persName ref="#textgrid:24gvp">Joh. Jac. Curts</persName> + <persName ref="#textgrid:24gvq">Wittwe</persName>. + <docDate>1791.<ptr target="#textgrid:24h5d"/></docDate></docImprint> + </titlePage> + <pb edRef="#b" type="sp" n="II"/></lem> + + <rdg wit="#a" type="ppl"> + <titlePage> + <titlePart type="main"><pb edRef="#a" type="sp" n="I"/> Anweisung + <lb/>zur <lb/>Bildung <lb/>angehender Theologen.</titlePart> + <lb/> + <byline>von <lb/> + <docAuthor><choice> + <abbr>D.</abbr> + <expan>Doctor</expan> + </choice> + <index indexName="persons"> + <term>Nösselt, Johann August</term> + </index><persName>Johann August + Nösselt</persName></docAuthor>.</byline> + <lb/> + <titlePart type="volume">Erster Theil.</titlePart> + <lb/> + <docImprint>Halle, <lb/>bey <index indexName="persons"> + <term>Curt, Johann Jacob</term> + </index><persName>Joh. Jac. Curts</persName> Wittwe. + <docDate>1786.<ptr target="#textgrid:24gvh"/><!-- BL: kein Link im RDF-Objekt --></docDate></docImprint> + </titlePage> + <pb edRef="#a" type="sp" n="II"/></rdg> + + <rdg wit="#c" type="ppl"> + <titlePage> + <titlePart type="main"><pb edRef="#c" type="sp" n="I"/> Anweisung + <lb/>zur <lb/>Bildung <lb/>angehender Theologen,</titlePart> + <lb/> + <byline>von <lb/><docAuthor><index indexName="persons"> + <term>Nösselt, Johann August</term> + </index><persName>Johann August Nösselt</persName>, <lb/><choice> + <abbr>weil.</abbr> + <expan>weiland</expan> + </choice> + <choice> + <abbr>Königl.</abbr> + <expan>Königlich</expan> + </choice> Preußischem Gemeinderath, Doctor und Professor + <lb/>der Theologie zu Halle.</docAuthor> + <lb/>Herausgegeben <lb/>und mit Anmerkungen, literarischen Zusätzen + <lb/>und Ergänzungen begleitet <lb/>von <lb/><choice> + <abbr>D.</abbr> + <expan>Doctor</expan> + </choice> + <index indexName="persons"> + <term>Niemeyer, August Hermann</term> + </index><persName role="editor" ref="#textgrid:24gvf">August Hermann + Niemeyer</persName>, <lb/><choice> + <abbr>Königl.</abbr> + <expan>Königlich</expan> + </choice> + <choice> + <abbr>Preuß.</abbr> + <expan>Preußisch</expan> + </choice> Oberkonsistorialrath, Kanzler und Professor der + Theo-<lb/>logie auf der vereinigten Friedrichsuniversität Halle und + Wittenberg, <lb/>Director der Frankischen Stiftungen, auch Ritter + <lb/>des rothen Adlerordens dritter Klasse.</byline> + <lb/> + <titlePart type="volume">Erster Band.</titlePart> + <lb/> + <docEdition>Dritte Auflage.</docEdition> + <lb/> + <docImprint>Halle, <lb/>im Verlage der <index indexName="persons"> + <term>Curt, Johann Jacob</term> + </index><persName>Curtschen</persName> Buchhandlung. + <lb/><docDate>1818.<ptr target="#textgrid:25484"/></docDate></docImprint> + </titlePage> + <pb edRef="#c" type="sp" n="II"/></rdg> + </app> + </div> + <div n="1"> + <head>Einfaches Beispiel mit pp und v</head> + <p>[...] was sie <hi>sollten</hi>, ist <app> + <lem>die: –</lem> + <rdg wit="#c" type="pp">die,</rdg> + </app> daß diese so selten richtige Begriffe von dem <app> + <lem>Umfang</lem> + <rdg wit="#c" type="v">Umfange</rdg> + </app>, dem <app> + <lem>Werth</lem> + <rdg type="v" wit="#c">Werthe</rdg> + </app> der Wissenschaften, [...]</p></div> + <div> + <head>Einfaches Beispiel mit mehreren parallelen Varianten</head> + <p><app> + <lem>Andrer</lem> + <rdg wit="#a" type="v">andrer</rdg> + <rdg wit="#c" type="v">Anderer</rdg> + </app> leiten <app> + <lem>laßen</lem> + <rdg wit="#a #c" type="v">lassen</rdg> + </app>, gegen die sie eine gewisse Vorliebe haben; kurz, weil sie + selten selbst</p> + </div> + <div n="2"> + <head>Einfaches Beispiel mit NON BLE Tag im tei:lem</head> + <note>bla</note> + <div><head>uk</head><p><app> + <lem>was</lem> + <rdg wit="#a #b" type="v"> + <app> + <rdg wit="#a"><hi>was</hi></rdg> + <rdg wit="b">WAS</rdg> + </app>,</rdg> + </app></p></div> + </div> + <div> + <head>Einfaches Beispiel mit tei:lem[@type='om'], tei:rdg[@type='om' | 'pt'] und tei:seg[@type='condensed']</head> + <head><seg xml:id="var_1_vorrede_c_head"><pb edRef="#a" type="sp" n="III"/> + <pb edRef="#b" type="sp" n="III"/> + <pb edRef="#c" n="XIII"/> + <app> + <lem>Vorrede</lem> + <rdg wit="#c" type="pp">Vorreden des Verfassers bei</rdg> + </app> + <app> + <lem>der ersten <app> + <lem/> + <rdg wit="#c" type="pt">und zweiten</rdg> + </app> Ausgabe</lem> + <rdg wit="#a" type="om"/> + </app>.</seg><seg type="condensed">I. Vorrede der ersten + Ausgabe</seg></head> + </div> + <div n="3"> + <head>Komplexes Beispiel mit tei:lem in tei:lem</head> + <p>ich <app> + <lem>durch</lem> + <rdg wit="#c" type="pp">bei Abfassung</rdg> + </app> dieses <app> + <lem>ganze Buch</lem> + <rdg wit="#c" type="pp">ganzen Buchs</rdg> + </app> vor Augen gehabt<app> + <lem>, und mich daher bemüht, theils Manches <app> + <lem>hervor zu ziehen</lem> + <rdg type="pp" wit="#c">hervorzuziehen</rdg> + </app>, was zu sehr <app> + <lem>bey</lem> + <rdg wit="#c" type="v">bei</rdg> + </app> dem Studieren der Theologie übersehen wird, theils + den wahren nur zu oft verkannten Werth mancher Studien und + Uebungen, besonders durch deutliche <app> + <lem>Beyspiele</lem> + <rdg wit="#c" type="v">Beispiele</rdg> + </app>, einleuchtender zu machen</lem> + <rdg wit="#a" type="om"/> + </app>.</p> + </div> + <div n="4"> + <head>Einfaches Beispiel mit tei:rdg[@type='ptl']</head> + <p><app> + <lem/> + <rdg wit="#a" type="ptl">Sollte man gerade einige der neuesten + vermissen, die Empfehlung verdient hätten: so muß ich + bemerken, daß ohngefehr die ersten zwölf Bogen dieses Buchs + schon fast vor zwey Jahren ab<pb edRef="#a" type="sp" n="XIII"/>gedruckt waren.</rdg> + </app></p> + </div> + <div n="5"> + <head>Komplexes Beispiel mit tei:rdg[@type='ptl'] und lehrem tei:lem</head> + <app> + <lem/> + <rdg wit="#c" type="ptl"> + <div type="preface" xml:id="preface_1_1_c"> + <head><pb edRef="#c" type="sp" n="III"/> Vorrede des Herausgebers.<seg type="condensed">I. Vorrede des Herausgebers (c)</seg></head> + <p>Es darf in einer Zeit, wo die unendliche Menge neuer Schriften so + leicht die älteren in Vergessenheit bringt, zu den erfreulichen + Erscheinungen gerechnet werden, daß, nachdem <hi>sieben und + zwanzig</hi> Jahre seit der <hi>letzten Ausgabe</hi> der + vorliegenden Schrift [...] <hi>nebst einer Sammlung seiner zum Theil + ungedruckten Aufsätze, Briefe und Fragmente</hi>, erschienen + ist.</p> + <p>Halle den 15ten März 1818. <lb/><hi rend="right-aligned">Der + Herausgeber.</hi></p> + </div></rdg> + </app> + </div> + <div n="6"> + <head>Hoch komplexes Beispiel mit Strukturapparat un tei:milestone</head> + <app type="structural-variance"> + <lem><seg xml:id="var_1_19_p1">Alles bisher <app> + <lem>gesagte</lem> + <rdg wit="#c" type="v">Gesagte</rdg> + </app> §. <app> + <lem><ref target="#section_1_15">15</ref>–<ref target="#section_1_19">19</ref> + <app> + <lem>kan</lem> + <rdg wit="#a" type="v">kann</rdg> + </app></lem> + <rdg wit="#c" type="pp"><ref target="#section_1_15">15</ref>–<ref target="#section_1_19">19.</ref> + kann</rdg> + </app> dazu dienen, angehenden Theologen Liebe und Achtung gegen + den Stand, dem sie sich widmen, <app> + <lem>einzuflössen</lem> + <rdg wit="#a #c" type="v">einzuflößen</rdg> + </app>, und sie von ihrer wahren Bestimmung zu belehren.</seg> + <app> + <lem/> + <rdg wit="#c" type="ptl"><milestone edRef="#c" type="structure" unit="p"/><seg xml:id="var_1_19_p2">{Dieß ist um so mehr + gleich bei dem [...] diesem Stande gewachsen + seyn werden.} <hi rend="right-aligned"><choice> + <abbr>A. d. H.</abbr> + <expan>Anmerkung des Herausgebers</expan> + </choice></hi></seg></rdg> + </app></lem> + <rdg type="var-structure" wit="#c"><p copyOf="#var_1_19_p1"/> + <p copyOf="#var_1_19_p2"/></rdg> + </app> + </div> + <div type="section-group"><div n="7"> + <head>Komplexes Beispiel mit tei:rdg[@type='ppl'] und ineinandergeschachtelten Apparaten</head> + <p><app> + <lem>könnte; und der hier angegebene scheint mit dem Sprachgebrauch am + meisten <app> + <lem>überein zu kommen</lem> + <rdg wit="#c" type="pp">übereinzukommen</rdg> + </app>, weil dadurch wirklich [...] Bequemlichkeit und Vergnügen, so wie mechanische + und bildende Künste, um Bildung des Geistes zu befördern. <list> + <item><choice> + <abbr>S.</abbr> + <expan>Siehe</expan> + </choice> + <hi>Philosophische Blicke auf Wissenschaften und + Menschenleben</hi>, von <index indexName="persons"> + <term>Heinzelmann, Johann Christian Friedrich</term> + </index><hi><persName ref="#textgrid:24kqp">Heinzelmann</persName></hi> und <app> + <lem><index indexName="persons"> + <term>Voss, Christian Daniel</term> + </index><hi><persName ref="#textgrid:24kqn">Voss</persName></hi>, Band.</lem> + <rdg wit="#c" type="pp"><hi><persName>Voß</persName></hi>, Band</rdg> + </app> 1.<!--<ptr target="#textgrid:24kqr"/>--> + <choice> + <abbr>S.</abbr> + <expan>Seite</expan> + </choice> 10 <choice> + <abbr>f.</abbr> + <expan>folgend</expan> + </choice></item> + </list> + </lem> + <rdg wit="#a" type="ppl">könnte. <ptr xml:id="klasse"/>Er hat den <index indexName="subjects"> + <term>Sprachgebrauch</term> + </index>Sprachgebrauch so gut [...] secundis tertiisque + consistere. <index indexName="classical-authors"> + <term><persName>Cicero, Marcus Tullius</persName> + <title>Orator.</title> + <measure>1</measure></term> + </index><persName ref="#textgrid:24gxq">Cicero</persName> Orator. <choice> + <abbr>cap.</abbr> + <expan>caput/capitulum</expan> + </choice> 1.</rdg> + </app></p> + </div></div> + <div> + <p> + <app> + <lem>Bla</lem> + <rdg type="ppl" wit="#a"> + <div> + <head> + <a>Blub + <note>hhj</note> + </a> + </head> + <p>Test</p> + </div> + </rdg> + <rdg type="ppl" wit="#b"> + Zeuge B + </rdg> + </app> + </p> + </div> + </body> + </text> +</TEI> diff --git a/oxygen/devel/data/samples2.xml b/oxygen/devel/data/samples2.xml new file mode 100644 index 0000000000000000000000000000000000000000..30ba3dc820656df804f8aa18a092c5d6cc4bf7d0 --- /dev/null +++ b/oxygen/devel/data/samples2.xml @@ -0,0 +1,322 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?> +<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" + schematypens="http://purl.oclc.org/dsdl/schematron"?> +<TEI xmlns="http://www.tei-c.org/ns/1.0"> + + <text> + <body> + <div n="0"> + <app> + <lem> + <titlePage> + <titlePart type="main"><pb edRef="#b" type="sp" n="I"/> + <choice> + <orig>Anweisung <lb/>zur <lb/>Bildung <lb/>angehender + Theologen,</orig> + <seg type="toc-item">Anweisung zur Bildung angehender + Theologen</seg> + </choice></titlePart> + <lb/> + <byline>von <lb/><docAuthor><choice> + <abbr>D.</abbr> + <expan>Doctor</expan> + </choice> + <index indexName="persons"> + <term>Nösselt, Johann August</term> + </index><persName ref="#textgrid:24gvc">Johann August + Nösselt</persName></docAuthor>.</byline> + <lb/> + <titlePart type="volume"><choice> + <orig>Erster Band.</orig> + <seg type="toc-item">Erster Band</seg> + </choice></titlePart> + <lb/> + <docEdition>Zweyte vermehrte und verbesserte Auflage.</docEdition> + <lb/> + <docImprint>Halle, <lb/>bey <index indexName="persons"> + <term>Curt, Johann Jacob</term> + </index><persName ref="#textgrid:24gvp">Joh. Jac. Curts</persName> + <persName ref="#textgrid:24gvq">Wittwe</persName>. + <docDate>1791.<ptr target="#textgrid:24h5d"/></docDate></docImprint> + </titlePage> + <pb edRef="#b" type="sp" n="II"/></lem> + + <rdg wit="#a" type="ppl"> + <titlePage> + <titlePart type="main"><pb edRef="#a" type="sp" n="I"/> Anweisung + <lb/>zur <lb/>Bildung <lb/>angehender Theologen.</titlePart> + <lb/> + <byline>von <lb/> + <docAuthor><choice> + <abbr>D.</abbr> + <expan>Doctor</expan> + </choice> + <index indexName="persons"> + <term>Nösselt, Johann August</term> + </index><persName>Johann August + Nösselt</persName></docAuthor>.</byline> + <lb/> + <titlePart type="volume">Erster Theil.</titlePart> + <lb/> + <docImprint>Halle, <lb/>bey <index indexName="persons"> + <term>Curt, Johann Jacob</term> + </index><persName>Joh. Jac. Curts</persName> Wittwe. + <docDate>1786.<ptr target="#textgrid:24gvh"/><!-- BL: kein Link im RDF-Objekt --></docDate></docImprint> + </titlePage> + <pb edRef="#a" type="sp" n="II"/></rdg> + + <rdg wit="#c" type="ppl"> + <titlePage> + <titlePart type="main"><pb edRef="#c" type="sp" n="I"/> Anweisung + <lb/>zur <lb/>Bildung <lb/>angehender Theologen,</titlePart> + <lb/> + <byline>von <lb/><docAuthor><index indexName="persons"> + <term>Nösselt, Johann August</term> + </index><persName>Johann August Nösselt</persName>, <lb/><choice> + <abbr>weil.</abbr> + <expan>weiland</expan> + </choice> + <choice> + <abbr>Königl.</abbr> + <expan>Königlich</expan> + </choice> Preußischem Gemeinderath, Doctor und Professor + <lb/>der Theologie zu Halle.</docAuthor> + <lb/>Herausgegeben <lb/>und mit Anmerkungen, literarischen Zusätzen + <lb/>und Ergänzungen begleitet <lb/>von <lb/><choice> + <abbr>D.</abbr> + <expan>Doctor</expan> + </choice> + <index indexName="persons"> + <term>Niemeyer, August Hermann</term> + </index><persName role="editor" ref="#textgrid:24gvf">August Hermann + Niemeyer</persName>, <lb/><choice> + <abbr>Königl.</abbr> + <expan>Königlich</expan> + </choice> + <choice> + <abbr>Preuß.</abbr> + <expan>Preußisch</expan> + </choice> Oberkonsistorialrath, Kanzler und Professor der + Theo-<lb/>logie auf der vereinigten Friedrichsuniversität Halle und + Wittenberg, <lb/>Director der Frankischen Stiftungen, auch Ritter + <lb/>des rothen Adlerordens dritter Klasse.</byline> + <lb/> + <titlePart type="volume">Erster Band.</titlePart> + <lb/> + <docEdition>Dritte Auflage.</docEdition> + <lb/> + <docImprint>Halle, <lb/>im Verlage der <index indexName="persons"> + <term>Curt, Johann Jacob</term> + </index><persName>Curtschen</persName> Buchhandlung. + <lb/><docDate>1818.<ptr target="#textgrid:25484"/></docDate></docImprint> + </titlePage> + <pb edRef="#c" type="sp" n="II"/></rdg> + </app> + </div> + <div n="1"> + <head>Einfaches Beispiel mit pp und v</head> + <p>[...] was sie <hi>sollten</hi>, ist <app> + <lem>die: –</lem> + <rdg wit="#c" type="pp">die,</rdg> + </app> daß diese so selten richtige Begriffe von dem <app> + <lem>Umfang</lem> + <rdg wit="#c" type="v">Umfange</rdg> + </app>, dem <app> + <lem>Werth</lem> + <rdg type="v" wit="#c">Werthe</rdg> + </app> der Wissenschaften, [...]</p></div> + <div> + <head>Einfaches Beispiel mit mehreren parallelen Varianten</head> + <p><app> + <lem>Andrer</lem> + <rdg wit="#a" type="v">andrer</rdg> + <rdg wit="#c" type="v">Anderer</rdg> + </app> leiten <app> + <lem>laßen</lem> + <rdg wit="#a #c" type="v">lassen</rdg> + </app>, gegen die sie eine gewisse Vorliebe haben; kurz, weil sie + selten selbst</p> + </div> + <div n="2"> + <head>Einfaches Beispiel mit NON BLE Tag im tei:lem</head> + <note>bla</note> + <div><head>uk</head><p><app> + <lem>was</lem> + <rdg wit="#a #b" type="v"> + <app> + <rdg wit="#a"><hi>was</hi></rdg> + <rdg wit="b">WAS</rdg> + </app>,</rdg> + </app></p></div> + </div> + <div> + <head>Einfaches Beispiel mit tei:lem[@type='om'], tei:rdg[@type='om' | 'pt'] und tei:seg[@type='condensed']</head> + <head><seg xml:id="var_1_vorrede_c_head"><pb edRef="#a" type="sp" n="III"/> + <pb edRef="#b" type="sp" n="III"/> + <pb edRef="#c" n="XIII"/> + <app> + <lem>Vorrede</lem> + <rdg wit="#c" type="pp">Vorreden des Verfassers bei</rdg> + </app> + <app> + <lem>der ersten <app> + <lem/> + <rdg wit="#c" type="pt">und zweiten</rdg> + </app> Ausgabe</lem> + <rdg wit="#a" type="om"/> + </app>.</seg><seg type="condensed">I. Vorrede der ersten + Ausgabe</seg></head> + </div> + <div n="3"> + <head>Komplexes Beispiel mit tei:lem in tei:lem</head> + <p>ich <app> + <lem>durch</lem> + <rdg wit="#c" type="pp">bei Abfassung</rdg> + </app> dieses <app> + <lem>ganze Buch</lem> + <rdg wit="#c" type="pp">ganzen Buchs</rdg> + </app> vor Augen gehabt<app> + <lem>, und mich daher bemüht, theils Manches <app> + <lem>hervor zu ziehen</lem> + <rdg type="pp" wit="#c">hervorzuziehen</rdg> + </app>, was zu sehr <app> + <lem>bey</lem> + <rdg wit="#c" type="v">bei</rdg> + </app> dem Studieren der Theologie übersehen wird, theils + den wahren nur zu oft verkannten Werth mancher Studien und + Uebungen, besonders durch deutliche <app> + <lem>Beyspiele</lem> + <rdg wit="#c" type="v">Beispiele</rdg> + </app>, einleuchtender zu machen</lem> + <rdg wit="#a" type="om"/> + </app>.</p> + </div> + <div n="4"> + <head>Einfaches Beispiel mit tei:rdg[@type='ptl']</head> + <p><app> + <lem/> + <rdg wit="#a" type="ptl">Sollte man gerade einige der neuesten + vermissen, die Empfehlung verdient hätten: so muß ich + bemerken, daß ohngefehr die ersten zwölf Bogen dieses Buchs + schon fast vor zwey Jahren ab<pb edRef="#a" type="sp" n="XIII"/>gedruckt waren.</rdg> + </app></p> + </div> + <div n="5"> + <head>Komplexes Beispiel mit tei:rdg[@type='ptl'] und lehrem tei:lem</head> + <app> + <lem/> + <rdg wit="#c" type="ptl"> + <div type="preface" xml:id="preface_1_1_c"> + <head><pb edRef="#c" type="sp" n="III"/> Vorrede des Herausgebers.<seg type="condensed">I. Vorrede des Herausgebers (c)</seg></head> + <p>Es darf in einer Zeit, wo die unendliche Menge neuer Schriften so + leicht die älteren in Vergessenheit bringt, zu den erfreulichen + Erscheinungen gerechnet werden, daß, nachdem <hi>sieben und + zwanzig</hi> Jahre seit der <hi>letzten Ausgabe</hi> der + vorliegenden Schrift [...] <hi>nebst einer Sammlung seiner zum Theil + ungedruckten Aufsätze, Briefe und Fragmente</hi>, erschienen + ist.</p> + <p>Halle den 15ten März 1818. <lb/><hi rend="right-aligned">Der + Herausgeber.</hi></p> + </div></rdg> + </app> + </div> + <div n="6"> + <head>Hoch komplexes Beispiel mit Strukturapparat un tei:milestone</head> + <app type="structural-variance"> + <lem><seg xml:id="var_1_19_p1">Alles bisher <app> + <lem>gesagte</lem> + <rdg wit="#c" type="v">Gesagte</rdg> + </app> §. <app> + <lem><ref target="#section_1_15">15</ref>–<ref target="#section_1_19">19</ref> + <app> + <lem>kan</lem> + <rdg wit="#a" type="v">kann</rdg> + </app></lem> + <rdg wit="#c" type="pp"><ref target="#section_1_15">15</ref>–<ref target="#section_1_19">19.</ref> + kann</rdg> + </app> dazu dienen, angehenden Theologen Liebe und Achtung gegen + den Stand, dem sie sich widmen, <app> + <lem>einzuflössen</lem> + <rdg wit="#a #c" type="v">einzuflößen</rdg> + </app>, und sie von ihrer wahren Bestimmung zu belehren.</seg> + <app> + <lem/> + <rdg wit="#c" type="ptl"><milestone edRef="#c" type="structure" unit="p"/><seg xml:id="var_1_19_p2">{Dieß ist um so mehr + gleich bei dem [...] diesem Stande gewachsen + seyn werden.} <hi rend="right-aligned"><choice> + <abbr>A. d. H.</abbr> + <expan>Anmerkung des Herausgebers</expan> + </choice></hi></seg></rdg> + </app></lem> + <rdg type="var-structure" wit="#c"><p copyOf="#var_1_19_p1"/> + <p copyOf="#var_1_19_p2"/></rdg> + </app> + </div> + <div type="section-group"><div n="7"> + <head>Komplexes Beispiel mit tei:rdg[@type='ppl'] und ineinandergeschachtelten Apparaten</head> + <p><app> + <lem>könnte; und der hier angegebene scheint mit dem Sprachgebrauch am + meisten <app> + <lem>überein zu kommen</lem> + <rdg wit="#c" type="pp">übereinzukommen</rdg> + </app>, weil dadurch wirklich [...] Bequemlichkeit und Vergnügen, so wie mechanische + und bildende Künste, um Bildung des Geistes zu befördern. <list> + <item><choice> + <abbr>S.</abbr> + <expan>Siehe</expan> + </choice> + <hi>Philosophische Blicke auf Wissenschaften und + Menschenleben</hi>, von <index indexName="persons"> + <term>Heinzelmann, Johann Christian Friedrich</term> + </index><hi><persName ref="#textgrid:24kqp">Heinzelmann</persName></hi> und <app> + <lem><index indexName="persons"> + <term>Voss, Christian Daniel</term> + </index><hi><persName ref="#textgrid:24kqn">Voss</persName></hi>, Band.</lem> + <rdg wit="#c" type="pp"><hi><persName>Voß</persName></hi>, Band</rdg> + </app> 1.<!--<ptr target="#textgrid:24kqr"/>--> + <choice> + <abbr>S.</abbr> + <expan>Seite</expan> + </choice> 10 <choice> + <abbr>f.</abbr> + <expan>folgend</expan> + </choice></item> + </list> + </lem> + <rdg wit="#a" type="ppl">könnte. <ptr xml:id="klasse"/>Er hat den <index indexName="subjects"> + <term>Sprachgebrauch</term> + </index>Sprachgebrauch so gut [...] secundis tertiisque + consistere. <index indexName="classical-authors"> + <term><persName>Cicero, Marcus Tullius</persName> + <title>Orator.</title> + <measure>1</measure></term> + </index><persName ref="#textgrid:24gxq">Cicero</persName> Orator. <choice> + <abbr>cap.</abbr> + <expan>caput/capitulum</expan> + </choice> 1.</rdg> + </app></p> + </div></div> + <div> + <p> + <app> + <lem>Bla</lem> + <rdg type="ppl" wit="#a"> + <div> + <head> + <a>Blub + <note>hhj</note> + </a> + </head> + <p>Test</p> + </div> + </rdg> + <rdg type="ppl" wit="#b"> + Zeuge B + </rdg> + </app> + </p> + </div> + </body> + </text> +</TEI> diff --git a/oxygen/devel/data/samples3.xml b/oxygen/devel/data/samples3.xml new file mode 100644 index 0000000000000000000000000000000000000000..6e9badac7e5158badde2f9b624e13ee2f7a395ec --- /dev/null +++ b/oxygen/devel/data/samples3.xml @@ -0,0 +1,153 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?> +<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" + schematypens="http://purl.oclc.org/dsdl/schematron"?> +<TEI xmlns="http://www.tei-c.org/ns/1.0"> + <text> + <app n="1"> + <lem><body> + <div> + <app n="2"> + <lem> + <div> + <seg> + <hi> + <app n="3"> + <lem> + <div> + <hi>OPEN SIGLE für app [1,2,3]/lem</hi> + <hi>Bla</hi> + </div> bla CLOSE SIGNLE für app[3]/lem + </lem> + <rdg type="v" wit="#c">OPEN SIGLE für app [3]/rdg"c" Blä CLOSE SIGNLE für app[3]/rdg"c"</rdg> + <rdg wit="#o" type="om"/> + </app> + </hi> + CLOSE SIGNLE für app[2]/lem + </seg> + </div> + </lem> + <rdg type="ppl" wit="#a"> + <div> + <head>OPEN SIGLE für app [2]/rdg"a" + <a>Blub <note><app n="4"> + <lem>OPEN SIGLE für app [4]/lem hhj CLOSE SIGLE für app [4]/lem</lem> + <rdg wit="#d" type="v">OPEN SIGLE für app [4]/rdg"#d" hallo CLOSE SIGLE für app [4]/rdg"#d"</rdg> + </app></note> + </a> + </head> + <p>Test CLOSE SIGLE für app[2]/rdg"a"</p> + </div> + </rdg> + <rdg type="v" wit="#f">F</rdg> + <rdg type="ppl" wit="#b">OPEN SIGLE für app [2]/rdg"b" Zeuge B <aligned>CLOSE SIGLE für app[2]/rdg"b" und app[1]/lem</aligned></rdg> + <rdg type="pt" wit="#c">C</rdg> + <rdg type="ppl" wit="#e">E</rdg> + <rdg type="om" wit="#g"></rdg> + </app> + </div> + </body></lem> + <rdg wit="#z" type="z">OPEN SIGLE für app [1]/rdg"z" test <note>note test CLOSE SIGLE für app[1]/rdg"z"</note></rdg> + <rdg wit="#t" type="l">hgjg</rdg> + <rdg wit="#r" type="l">hgjg</rdg> + </app> + <app> + <lem> + <div type="preface"> + <head><pb edRef="#c" type="sp" n="III"/>Vorrede. <lb/>zur dritten Ausgabe.<seg type="condensed">Vorrede zur dritten Ausgabe</seg></head> + <p>Der schnelle ... <note type="editorial">Anmerkung</note>gegen ihre Gewohnheit zu nehmen sich + entschliessen mußte. <lb/>Jena <lb/>im September 1787. <lb/><lb/> + <hi rend="right-aligned">D. J. J. Griesbach.</hi></p> + </div> + </lem> + <rdg wit="#a #b #d" type="om"/> + </app> + <app> + <lem> + <div> + <p> + <app> + <lem>Kein Griesbach</lem> + <rdg wit="#b" type="ptl"> + <aligned rend="right-aligned">J. J. Griesbach</aligned> + </rdg> + </app> + </p> + </div> + </lem> + <rdg wit="#a #d" type="om"/> + </app> + <app> + <lem><div type="preface"> + <head>SIG-OPEN(lem[a,d]) Vorrede. <lb/><app> + <lem>SIG-OPEN(lem2[b]) Zur zweiten Ausgabe. SIG-CLOSE(lem2[b])</lem> + <rdg wit="#b" type="om"/> + </app><seg type="condensed">Vorrede zur zweiten Ausgabe</seg></head> + <p>Vor sieben Jahren ... Fürstlich Sächsischen Gesammt Akademie zu Jena, im März + 1786. <hi>Uwe</hi> <hi>Uwe</hi><app> + <lem /> + <rdg wit="#b" type="ptl"><aligned rend="right-aligned">SIG-OPEN(rdg"b") J. J. Griesbach SIG-CLOSE(rdg"b") SIG-CLOSE(lem) + </aligned></rdg> + </app></p> + </div></lem> + <rdg wit="#t" type="v">hgjg</rdg> + <rdg wit="#a" type="v">ghshghg</rdg> + <rdg wit="#a #d" type="om"/> + </app> + <app> + <lem> + <div> + <app> + <lem> + <head>Schnullibumms</head> + </lem> + <rdg wit="k" type="v">k</rdg> + <rdg wit="l" type="v">l</rdg> + <rdg wit="m" type="ptl">m</rdg> + </app> + </div> + </lem> + <rdg wit="q" type="v">q</rdg> + <rdg wit="r" type="v">r</rdg> + <rdg wit="s" type="ptl">s</rdg> + </app> + <div> + <app> + <lem> + <app> + <lem>beigelegt werden können;</lem> + <rdg wit="#a" type="pp">beigeleget werden,</rdg> + </app> + </lem> + <rdg wit="#d" type="pp">Theil nehmen und wahrhaft göttliche Werke verrichten kann;</rdg> + </app> + </div> + <div type="section-group"> + <app> + <lem>Test</lem> + <rdg type="ptl" wit="#c"> + <div type="preface"> + <p> + <hi rend="right-aligned">Der Herausgeber <index><term>asasas</term></index></hi> + </p> + <note type="editorial"> + <label>asdf</label> + <p>dgdgh</p> + </note> + </div> + </rdg> + </app> + </div> + <div> + <p>Das ist ein Test + der über <hi>zwei</hi> <hi>oder</hi> mehrere Zeilen + <choice> + <var>läuft!</var> + <var>laeuft!</var> + </choice> + </p> + <p>Das ist der<pb/> Test und derein<pb/>zige Test der <pb/> <hi>page</hi><pb/><hi>bre<lb>uzgtats</lb>aks + richtig zählt</hi></p> + </div> + </text> +</TEI> diff --git a/oxygen/devel/data/samples4.xml b/oxygen/devel/data/samples4.xml new file mode 100644 index 0000000000000000000000000000000000000000..b8e155022645dc6c2885dc5e26f18a52f4c55e84 --- /dev/null +++ b/oxygen/devel/data/samples4.xml @@ -0,0 +1,158 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?> +<?xml-model href="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" + schematypens="http://purl.oclc.org/dsdl/schematron"?> +<TEI xmlns="http://www.tei-c.org/ns/1.0"> + <text> + <app n="1"> + <lem> + <div> + <head> + <item> + <hi> + <item><hi>Überschrift</hi></item> + </hi> + </item> <hi>1</hi> + </head> + <p>Erster Paragraph</p> + <p> + <hi> + <aligned> + <app> + <lem> + <l> + <label>Zweiter Paragraph</label> + </l> + </lem> + <rdg type="v" wit="#a">Erste V zu Zweiter Paragraph</rdg> + <rdg type="ppl" wit="#b">PPL zu Zweiter Paragraph</rdg> + <rdg type="v" wit="#c">Zweite V zu Zweiter Paragraph</rdg> + </app> + </aligned> + </hi> + </p> + </div> + </lem> + <rdg wit="#z" type="om"></rdg> + <rdg wit="#t" type="ppl"> + <p>Erster Paragraph in T</p> + <p>Zweiter Paragraph in T</p> + </rdg> + <rdg wit="#r" type="ppl"> + <p>Erster Paragraph in R</p> + <p>Zweiter Paragraph in R</p> + </rdg> + </app> + <app> + <lem> + <div>APP2</div> + </lem> + <rdg wit="#z" type="om"></rdg> + <rdg wit="#t" type="ppl"> + <p>Erster Paragraph in T</p> + <p>Zweiter Paragraph in T</p> + </rdg> + </app> + <app> + <lem> + <div> + <app> + <lem></lem> + <rdg wit="#h" type="ppl"> + <p>Erster Paragraph in H</p> + <p>Zweiter Paragraph in H</p> + </rdg> + </app> + </div> + </lem> + <rdg wit="#g" type="ppl"> + <p>Erster Paragraph in G</p> + </rdg> + </app> + <app n="TEST1"> + <lem> + <seg> + <div> + <list> + <item>Item 1</item> + <item>Item 2</item> + </list> + <note> + <seg>Anmerkung 1</seg> + </note> + </div> + </seg> + </lem> + <rdg wit="#g" type="ppl"> + <seg>Erstes SEG in G</seg> + <seg> + <p> + <app> + <lem>Erster Absatz in lem</lem> + <rdg wit="#b" type="pp">Erster Absatz in rdg</rdg> + </app> + </p> + <p> + Zweiter Absatz in <hi>HI</hi> + </p> + </seg> + </rdg> + </app> + <app n="TEST2"> + <lem> + <div> + <head>Test 2</head> + <p>Erste Absatz von Test 2</p> + <p> + <app> + <lem>Zweiter Absatz von Test 2</lem> + <rdg wit="#b" type="pp"><hi>Zweiter Absatz von Test 2</hi></rdg> + </app> + </p> + </div> + </lem> + <rdg wit="#z" type="om"></rdg> + </app> + <app n="TEST3"> + <lem> + <div> + <head> + <app> + <lem> + <hi>Test 3 in lem</hi> + </lem> + <rdg wit="#c" type="ptl"> + <aligned>Test 3 (aligned in rdg)</aligned> + </rdg> + </app> + </head> + <p> + Erster Absatz in Test 3 + <aligned> + <app> + <lem> + <hi>Aligned im ersten Absatz im lem</hi> + </lem> + <rdg wit="#c" type="v">Aligned im ersten Absatz im rdg[v]</rdg> + </app> + </aligned> + </p> + </div> + </lem> + <rdg wit="#a" type="om"></rdg> + <rdg wit="#b" type="ptl"> + <div> + <app> + <lem /> + <rdg wit="#e" type="ppl"> + <p>PPL P in E</p> + </rdg> + <rdg wit="#d" type="ppl"> + <note>PPL NOTE in d</note> + </rdg> + </app> + </div> + </rdg> + </app> + </text> +</TEI> diff --git a/oxygen/devel/modules/appindex.xqm b/oxygen/devel/modules/appindex.xqm new file mode 100644 index 0000000000000000000000000000000000000000..9363dc998ab7d55660a061a5e4c2c1528e1df897 --- /dev/null +++ b/oxygen/devel/modules/appindex.xqm @@ -0,0 +1,5 @@ +xquery version "3.0"; + +module namespace app="http://www.interform.com/app_index"; +declare default element namespace "http://www.tei-c.org/ns/1.0"; + diff --git a/stable/modules/string.xqm b/oxygen/devel/modules/string.xqm similarity index 100% rename from stable/modules/string.xqm rename to oxygen/devel/modules/string.xqm diff --git a/oxygen/devel/modules/targetindex.xqm b/oxygen/devel/modules/targetindex.xqm new file mode 100644 index 0000000000000000000000000000000000000000..740f5d0be741c36cd34abb4b4baa22ce1b5827a3 --- /dev/null +++ b/oxygen/devel/modules/targetindex.xqm @@ -0,0 +1,139 @@ +xquery version "3.0"; + +module namespace target="http://www.interform.com/target_index"; +declare default element namespace "http://www.tei-c.org/ns/1.0"; + +declare namespace markerset = "http://www.interform.com/markerset"; +import module "http://www.interform.com/markerset" at "markerset.xqm"; + +declare function target:index + ( $app-index as node() ) as item()* { + + let $targets := $app-index//target + let $targets-ids := distinct-values($targets/@gid) + for $id in $targets-ids + let $findings := $targets[@gid eq $id] + let $target := target:group-target-by-id($id, $targets) + return + $target +}; + +declare function target:group-target-by-id + ( $target-id as xs:string?, $targets as node()* ) as item()* { + + let $target-cluster := $targets[@gid eq $target-id] + let $target-name := $target-cluster/child::node()/name()[1] + let $markerset := target:collect-target-markersets($target-cluster) + return + element {"target"}{ + attribute {"id"}{$target-id}, + attribute {"name"}{$target-name[1]}, + $markerset + } + +}; + +declare function target:collect-target-markersets + ( $target-cluster ) as item()* { + + for $finding in $target-cluster + let $marker-type := $finding/@type + let $reading := $finding/parent::node() + let $reading-shortcut := element { $reading/name() }{ $reading/@* } + let $hierarchy := $reading/parent::app/string(@n) + let $markerset := $reading/markerset + return + element { "markerset" }{ + attribute { "hierarchy" }{ $hierarchy }, + attribute { "type" }{ $marker-type }, + target:compose-markers($markerset, $marker-type) + } + +}; + +declare function target:compose-markers + ( $markerset, $marker-type ) as item()* { + + if ( $marker-type eq "open" ) then ( + target:compose-open-markers($markerset) + ) + else if ( $marker-type eq "close" ) then ( + target:compose-close-markers($markerset) + ) + else if ( $marker-type eq "open close" ) then ( + target:compose-open-markers($markerset), + target:compose-close-markers($markerset) + ) + else ( + $markerset + ) + +}; + +declare function target:compose-open-markers + ( $markerset ) as item()* { + + let $markers := ( + for $marker in $markerset/node() + return + markerset:marker("rdgMarker", "open", $marker) + ) + + return element{"open"}{ + $markers + } +}; + +declare function target:compose-close-markers + ( $markerset ) as item()* { + + let $markers := ( + for $marker in $markerset/node() + return + markerset:marker("rdgMarker", "close", $marker) + ) + + return element{"close"}{ + reverse($markers) + } +}; + +declare function target:conversion-by-target-index + ( $nodes as node()*, $target-index as item()* ) as item()* { + + for $node in $nodes + return + typeswitch($node) + case processing-instruction() return () + case text() return ($node) + case comment() return ((:$node:)) + default return ( + let $found := $target-index[@id eq generate-id($node)] + return + if ($found) then ( + let $open := $found//open/node() + let $close-set := ( + for $set in $found/markerset + order by $set/string(@hierarchy) descending + return + <h>{$set}</h> + ) + + let $close := $close-set//close/node() + return ( + $open, + element {$node/name()}{ + (:attribute {"gid"}{ generate-id($node) },:) + $node/@*, + target:conversion-by-target-index($node/node(), $target-index) + }, + $close + ) + ) else ( + element {$node/name()}{ + $node/@*, + target:conversion-by-target-index($node/node(), $target-index) + } + ) + ) +}; \ No newline at end of file diff --git a/oxygen/functx.xqm b/oxygen/functx.xqm new file mode 100644 index 0000000000000000000000000000000000000000..749a38f90c8450b3986e35a0cfa3b74ea29fda5a --- /dev/null +++ b/oxygen/functx.xqm @@ -0,0 +1,65 @@ +xquery version "1.0"; +module namespace functx = "http://www.functx.com"; + + +declare function functx:is-value-in-sequence + ( $value as xs:anyAtomicType? , + $seq as xs:anyAtomicType* ) as xs:boolean { + + $value = $seq +} ; + + +declare function functx:first-node + ( $nodes as node()* ) as node()? { + + ($nodes/.)[1] +} ; + + +declare function functx:last-node + ( $nodes as node()* ) as node()? { + + ($nodes/.)[last()] +} ; + + +declare function functx:index-of-node + ( $nodes as node()* , + $nodeToFind as node() ) as xs:integer* { + + for $seq in (1 to count($nodes)) + return $seq[$nodes[$seq] is $nodeToFind] +} ; + + +declare function functx:add-attributes + ( $elements as element()* , + $attrNames as xs:QName* , + $attrValues as xs:anyAtomicType* ) as element()? { + + for $element in $elements + return element { node-name($element)} + { for $attrName at $seq in $attrNames + return if ($element/@*[node-name(.) = $attrName]) + then () + else attribute {$attrName} + {$attrValues[$seq]}, + $element/@*, + $element/node() } +} ; + +declare function functx:is-node-in-sequence + ( $node as node()? , + $seq as node()* ) as xs:boolean { + + some $nodeInSeq in $seq satisfies $nodeInSeq is $node + } ; + + + declare function functx:is-node-in-sequence-deep-equal + ( $node as node()? , + $seq as node()* ) as xs:boolean { + + some $nodeInSeq in $seq satisfies deep-equal($nodeInSeq,$node) + } ; \ No newline at end of file diff --git a/oxygen/intermediate_format.oxygen.devel.xqm b/oxygen/intermediate_format.oxygen.devel.xqm new file mode 100644 index 0000000000000000000000000000000000000000..3a79d9808dc03f4ac00a74c74ba38b9b28e92f72 --- /dev/null +++ b/oxygen/intermediate_format.oxygen.devel.xqm @@ -0,0 +1,187 @@ +xquery version "3.0"; + + +declare default element namespace "http://www.tei-c.org/ns/1.0"; + +import module namespace functx = "http://www.functx.com" at "functx.xqm"; +import module namespace markerset = "http://bdn.edition.de/intermediate_format/markerset" at "../modules/intermediate_format/markerset.xqm"; +import module namespace pre = "http://bdn.edition.de/intermediate_format/preprocessing" at "../modules/intermediate_format/preprocessing.xqm"; +import module namespace ident = "http://bdn.edition.de/intermediate_format/identification" at "../modules/intermediate_format/identification.xqm"; + +(:declare namespace target = "http://www.interform.com/target_index"; +import module "http://www.interform.com/target_index" at "targetindex.xqm"; +:) + + +declare namespace tei = "http://www.tei-c.org/ns/1.0"; +(:declare option saxon:output "indent=no";:) + + +declare variable $apparatus := ('app'); +declare variable $apparatus-childs := ('lem', 'rdg'); +declare variable $blocklevel-elements := ('titlePage', 'titlePart', 'aligned', 'div', 'list', 'item', 'table', 'row', 'cell', 'head', 'p', 'note'); + + +declare function local:in-sequence + ( $values as xs:anyAtomicType* , $sequence as xs:anyAtomicType*) as xs:boolean { + + $values = $sequence +}; + + +declare function local:app-index + ( $apps as node()* ) as item()* { + + let $entries := ( + for $app at $nr in $apps + let $readings := $app/child::node()[self::lem or self::rdg] + return + element {$app/name()}{ + attribute {"n"}{$nr}, + local:check-readings($readings) + } + ) + return element {"appIndex"}{ attribute {"count"}{ count($entries) }, $entries } +}; + + +(:declare function local:target-in-index + ( $target-id as xs:string?, $app-index as node() ) as item()* { + + if ( $target-id ) then ( + let $readings := $app-index//node()[self::first or self::last][@target = $target-id] + return + $readings + ) else ( ) + +};:) + + +declare function local:controll-app + ($app as node()) as item()* { + + let $self := $app + let $readings := $app/child::node()[self::lem or self::rdg] + return + element {$app/name()}{ + $app/@*, + local:check-readings($readings) + } +}; + +(: WORKS :) +declare function local:first-descendants + ($node as node()?) as node()* { + + let $first-child := $node/child::node()[1][not(self::text())] + return + if($first-child) then ($first-child, local:first-descendants($first-child)) else () +}; + + +(: WORKS :) +declare function local:last-descendants + ($node as node()?) as node()* { + + let $last-child := ( + let $target := $node/child::node()[last()][not(self::text())] + return + if ($target[self::app]) then ( + (: Possibility to jump into rdg[type="ppl, ptl, pp, pt"]:) + $target/lem + ) + else ( + $target + ) + ) + return + if($last-child) then ($last-child, local:last-descendants($last-child)) else () +}; + + +declare function local:check-readings + ( $readings as node()* ) as item()* { + + for $reading in $readings + return local:check-reading($reading) +}; + + + +declare function local:check-reading + ( $reading as node() ) as item()* { + + let $first-save-node := local:first-descendants($reading)[ local:is-save-first-node(self::node()) ][1] + let $last-save-node := local:last-descendants($reading)[ local:is-save-last-node(self::node()) ][1] + return + element {$reading/name()}{ + $reading/@*, + (:element {"SELF"}{ + $reading + },:) + if ( $reading[ not(@type eq "om" or empty($reading/node())) ] ) then ( + if ($first-save-node eq $last-save-node) then ( + element{"target"}{ + (:attribute {"id"}{ $first-save-node/string(@interformId) },:) + attribute {"gid"}{ generate-id( $first-save-node ) }, + attribute {"type"} {"open close"}, + $first-save-node + } + ) else ( + element {"target"}{ + (:attribute {"id"}{ $first-save-node/string(@interformId) },:) + attribute {"gid"}{ generate-id( $first-save-node ) }, + attribute {"type"} {"open"}, + $first-save-node + }, + element {"target"}{ + (:attribute {"id"}{ $last-save-node/string(@interformId) },:) + attribute {"gid"}{ generate-id( $last-save-node ) }, + attribute {"type"} {"close"}, + $last-save-node + } + ), + markerset:collect-markers($reading) + ) else () + } +}; + + + + + +declare function local:is-save-first-node + ($node as node()) as xs:boolean { + let $first-descendants := local:first-descendants($node) + let $has-save-first-descendants := not ( local:in-sequence($first-descendants/name(), $blocklevel-elements) ) + let $self-ble := functx:is-value-in-sequence( $node/name(), $blocklevel-elements ) + return + if ($has-save-first-descendants and not ($self-ble)) then (true()) else (false()) +}; + +declare function local:is-save-last-node + ($node as node()) as xs:boolean { + let $last-descendants := local:last-descendants($node) + let $has-save-last-descendants := not ( local:in-sequence($last-descendants/name(), $blocklevel-elements) ) + let $self-ble := functx:is-value-in-sequence( $node/name(), $blocklevel-elements ) + return + if ($has-save-last-descendants and not ($self-ble)) then (true()) else (false()) +}; + + + + +let $doc := . +let $pre := pre:preprocessing($doc/node()) +(:let $pre := pre:preprocessing($doc/node()) +let $app-index := local:app-index( $pre//app[not(@type)] ) +let $target-index := target:index($app-index):) + +return ( + (:ident:identify-unit-test($pre):) +(: $pre:) + ident:walk($pre, ()) +(: $target-index:) + (:local:target-in-index("d0t36", $app-index),:) + (:target:conversion-by-target-index($pre, $target-index):) +) \ No newline at end of file diff --git a/rest/intermediate_format.xql b/rest/intermediate_format.xql new file mode 100644 index 0000000000000000000000000000000000000000..50e8c1838056693ea96a5aed2c7e0416a10dbae3 --- /dev/null +++ b/rest/intermediate_format.xql @@ -0,0 +1,18 @@ +xquery version "3.1"; + +declare namespace tei = "http://www.tei-c.org/ns/1.0"; +import module namespace functx="http://www.functx.com"; +import module namespace pre="http://bdn.edition.de/intermediate_format/preprocessing" at "xmldb:exist:///db/apps/interform/modules/intermediate_format/preprocessing.xqm"; +import module namespace ident = "http://bdn.edition.de/intermediate_format/identification" at "xmldb:exist:///db/apps/interform/modules/intermediate_format/identification.xqm"; + + +declare option exist:serialize "method=xml media-type=text/xml omit-xml-declaration=no indent=no"; + +(: http://localhost:8080/exist/rest/apps/interform/rest/intermediate_format.xql :) +declare variable $doc-path := request:get-parameter("path", ()); +(:declare variable $doc-path := "/apps/interform/data/sample1.xml";:) +let $doc := doc($doc-path) +let $preprocessed-data := pre:preprocessing($doc/tei:TEI) +return ( + ident:walk($preprocessed-data, ()) +) \ No newline at end of file diff --git a/stable/modules/intermediate_format/inter_form.xqm b/stable_old/modules/intermediate_format/inter_form.xqm similarity index 100% rename from stable/modules/intermediate_format/inter_form.xqm rename to stable_old/modules/intermediate_format/inter_form.xqm diff --git a/stable_old/modules/string.xqm b/stable_old/modules/string.xqm new file mode 100644 index 0000000000000000000000000000000000000000..b63be38773bd6bce80856ca648949a53f5b375c3 --- /dev/null +++ b/stable_old/modules/string.xqm @@ -0,0 +1,49 @@ +xquery version "3.1"; + +module namespace string="xmldb:exist:///db/apps/bdn/modules/string.xqm"; + + +(:~ + : string:escape-whitespace + : This function replaces whitespaces in a text() + : with one defined preservation character + : + : @version 1.0 (2017-09-14) + : @author Uwe Sikora + :) +declare function string:escape-whitespace + ($text, $escape as xs:string) as item()* { + + replace($text, '[\s]+', $escape) +}; + + +(:~ + : string:normalize + : + : @version 1.0 (2017-09-14) + : @author Uwe Sikora + :) +declare function string:normalize + ($text, $norm_character as xs:string) as item()* { + + let $norm_expression := concat('[', $norm_character, ']+') + return + replace($text, $norm_expression, $norm_character) +}; + + +(:~ + : string:escape-and-normalize + : + : @version 1.0 (2017-09-14) + : @author Uwe Sikora + :) +declare function string:escape-and-normalize + ($text as node(), $norm_character as xs:string) as item()* { + + let $save := string:escape-whitespace(normalize-space($text), $norm_character) + let $reduce := string:normalize($save, $norm_character) + return + $reduce +}; \ No newline at end of file diff --git a/stable/rest/intermediate_format.xql b/stable_old/rest/intermediate_format.xql similarity index 100% rename from stable/rest/intermediate_format.xql rename to stable_old/rest/intermediate_format.xql