Skip to content
Snippets Groups Projects
Commit 3926b8df authored by Michelle Weidling's avatar Michelle Weidling :blowfish:
Browse files

Merge branch 'bugfix/consider-tei-app-as-highest-element' into 'develop'

Consider structural variance on chapter level (cf. bdn-SADE#36)

See merge request !1
parents 2a25323b 3e1f8e9f
No related branches found
No related tags found
1 merge request!1Consider structural variance on chapter level (cf. bdn-SADE#36)
(:~
(:~
: ifweb.xql offers a simple interface for creating the website specific BdN
: intermediate format of a given resource.
:
:
: @author Michelle Rodzis
: @version 1.0
:
:
:)
xquery version "3.1";
......@@ -24,17 +24,17 @@ declare variable $ifweb:replace-whitespace := true();
declare function ifweb:main($resource as xs:string) as xs:string? {
let $doc := doc($config:sade-data || $resource)
let $filename := substring-before($resource, '.xml') || "-if.xml"
return ifweb:transform($doc, $filename)
};
declare function ifweb:transform($doc as node()*, $filename as xs:string)
declare function ifweb:transform($doc as node()*, $filename as xs:string)
as node()* {
let $preprocessed-data := pre:preprocessing($doc/tei:TEI, $ifweb:replace-whitespace)
let $intermediate-format := ident:walk($preprocessed-data, ())
let $store := xmldb:store($config:sade-data, $filename, $intermediate-format)
return $intermediate-format
};
......@@ -44,12 +44,12 @@ $target-dir as xs:string) as node()* {
let $preprocessed-data := pre:preprocessing($doc/tei:TEI, $ifweb:replace-whitespace)
let $intermediate-format := ident:walk($preprocessed-data, ())
let $store := xmldb:store($target-dir, $filename, $intermediate-format)
return $intermediate-format
};
declare function ifweb:complete-xml($author as xs:string, $xml as node()*)
declare function ifweb:complete-xml($author as xs:string, $xml as node()*)
as node()* {
let $filename := $author || "-full-if.xml"
return ifweb:transform($xml, $filename)
......@@ -61,17 +61,32 @@ $target-dir as xs:string) as node()* {
return ifweb:transform($resource, $filename, $target-dir)
};
declare function ifweb:transform-split-xml($xml as node()*, $filename as xs:string,
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 $intermediate-format := ident:walk($preprocessed-data, ())
let $content :=
element tei:div {
(: sometimes we have structural variance on chapter level - in these cases
tei:app is the root element of $xml, not tei:div. for the HTML serialization
of the structural variance to function properly we have to preserve the
tei:app :)
let $content :=
if($xml[self::tei:app]) then
element tei:app {
$xml/@*,
attribute id {generate-id($xml)},
$intermediate-format
}
let $store := xmldb:store($dir, $filename, $content)
else
($xml/@*,
attribute id {generate-id($xml)},
$intermediate-format)
let $transformed :=
element tei:div {
$content
}
let $store := xmldb:store($dir, $filename, $transformed)
return $intermediate-format
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment