Commit a44e32a4 authored by Mathias Goebel's avatar Mathias Goebel 🎠 Committed by mrodzis
Browse files

using a deep-equal to filter for distinct notes. would be better to prevent...

using a deep-equal to filter for distinct notes. would be better to prevent double preparation, closes #127
parent 7b68c7d8
...@@ -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.1 : @version 1.2
: @since 3.2.2 : @since 3.2.2
: :) : :)
...@@ -16,8 +16,9 @@ declare namespace tei="http://www.tei-c.org/ns/1.0"; ...@@ -16,8 +16,9 @@ declare namespace tei="http://www.tei-c.org/ns/1.0";
declare namespace test="http://exist-db.org/xquery/xqsuite"; declare namespace test="http://exist-db.org/xquery/xqsuite";
declare namespace xhtml="http://www.w3.org/1999/xhtml"; declare namespace xhtml="http://www.w3.org/1999/xhtml";
import module namespace rest="http://exquery.org/ns/restxq"; import module namespace functx="http://www.functx.com";
import module namespace ixp="http://fontane-nb.dariah.eu/index-processor" at "index-processor.xqm"; import module namespace ixp="http://fontane-nb.dariah.eu/index-processor" at "index-processor.xqm";
import module namespace rest="http://exquery.org/ns/restxq";
declare variable $stk:dataPath := "/db/sade-projects/textgrid/data/xml/data"; declare variable $stk:dataPath := "/db/sade-projects/textgrid/data/xml/data";
declare variable $stk:dataCollection := collection($stk:dataPath); declare variable $stk:dataCollection := collection($stk:dataPath);
...@@ -75,15 +76,20 @@ as element(xhtml:div) ...@@ -75,15 +76,20 @@ as element(xhtml:div)
element xhtml:div { element xhtml:div {
attribute class { "notes" }, attribute class { "notes" },
element xhtml:ul { element xhtml:ul {
for $note in $page/(.//tei:*[@xml:id=$noteTargets] | .//tei:figure[@xml:id][tei:figDesc]) let $preparedNotes :=
let $note := if($note/local-name() != "figure") for $note in $page/(.//tei:*[@xml:id=$noteTargets] | .//tei:figure[@xml:id][tei:figDesc])
then $doc//tei:note[contains(@target, "#" || $note/@xml:id)] let $note := if($note/local-name() != "figure")
else $note then $doc//tei:note[contains(@target, "#" || $note/@xml:id)]
else $note
return
element xhtml:li {
attribute class { 'editorialNote' },
stk:noteParser($note)
}
for $pN at $pos in $preparedNotes
where functx:index-of-deep-equal-node($preparedNotes, $pN)[1] eq $pos
return return
element xhtml:li { $pN
attribute class { 'editorialNote' },
stk:noteParser($note)
}
} }
} }
}; };
......
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