Commit 5f613e5e authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

place info on sketches at the editorial commentary. order items by occurence

parent a0500a23
...@@ -5,7 +5,7 @@ xquery version "3.1"; ...@@ -5,7 +5,7 @@ xquery version "3.1";
: :
: @author Simon Sendler : @author Simon Sendler
: @author Mathias Göbel : @author Mathias Göbel
: @version 1.0 : @version 1.1
: @since 3.2.2 : @since 3.2.2
: :) : :)
...@@ -63,15 +63,22 @@ as element(xhtml:div) ...@@ -63,15 +63,22 @@ as element(xhtml:div)
let $docpath := $stk:dataPath || "/" || $uri || ".xml" let $docpath := $stk:dataPath || "/" || $uri || ".xml"
let $doc := doc($docpath) let $doc := doc($docpath)
let $surface := tokenize($surface, "-") let $surface := tokenize($surface, "-")
let $reference := $doc//tei:surface[@n = $surface]//@xml:id let $page := $doc//tei:surface[@n = $surface]
let $notes := $doc//tei:note[@type="editorial"]
let $noteTargets := ($notes/@target ! replace(., "#", ""))
! tokenize(., " ")[contains(., "_"||$surface[1]||"_") or contains(., "_"||$surface[2]||"_")]
return return
if (not(doc-available($docpath))) then error(QName("https://sade.textgrid.de/ns/error/fontane", "STK01"), "Document not in database.") else if (not(doc-available($docpath))) then error(QName("https://sade.textgrid.de/ns/error/fontane", "STK01"), "Document not in database.") else
if (not($surface = $doc//tei:surface/@n)) then error(QName("https://sade.textgrid.de/ns/error/fontane", "STK02"), "Surface «" || $surface || "» not available.") else if (not($surface = $doc//tei:surface/@n)) then error(QName("https://sade.textgrid.de/ns/error/fontane", "STK02"), "Surface «" || $surface || "» not available.") else
element xhtml:div { element xhtml:div {
attribute class { "notes" }, attribute class { "notes" },
element xhtml:ul { element xhtml:ul {
for $note in $doc//tei:note[@type="editorial"] for $note in $page/(.//tei:*[@xml:id=$noteTargets] | .//tei:figure[@xml:id][tei:figDesc])
where $note/@target => replace("#", "") => tokenize(" ") = $reference let $note := if($note/local-name() != "figure")
then $doc//tei:note[contains(@target, "#" || $note/@xml:id)]
else $note
return return
element xhtml:li { element xhtml:li {
attribute class { 'editorialNote' }, attribute class { 'editorialNote' },
...@@ -175,6 +182,7 @@ declare function stk:noteParser($note as node()*) ...@@ -175,6 +182,7 @@ declare function stk:noteParser($note as node()*)
let $uri := $TGuri => substring-after(":") let $uri := $TGuri => substring-after(":")
let $pattern := "^#.+_.+_.+$" let $pattern := "^#.+_.+_.+$"
return return
if(starts-with($node/@target, "http:")) then $node//text() else
if (matches($node/@target, $pattern)) then if (matches($node/@target, $pattern)) then
let $target := replace($node/@target, "#", "") let $target := replace($node/@target, "#", "")
return return
...@@ -208,7 +216,18 @@ declare function stk:noteParser($note as node()*) ...@@ -208,7 +216,18 @@ declare function stk:noteParser($note as node()*)
$node/@style, $node/@style,
stk:noteParser($node/node()) stk:noteParser($node/node())
} }
case element (tei:figure) return
element xhtml:span {
attribute class { "target" },
"<Skizze>]",
element xhtml:ul {
element xhtml:li {
stk:noteParser($node/node())
}
}
}
case element (tei:figDesc) return
stk:noteParser($node/node())
case text() return $node case text() return $node
default return default return
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment