This repository has been archived by the owner on Jan 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtabular.xquery
62 lines (58 loc) · 2.38 KB
/
tabular.xquery
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
xquery version "3.0";
declare namespace tei = "http://www.tei-c.org/ns/1.0";
(: Local function written by David J. Birnbaum ([email protected]) :)
declare namespace djb = "www.obdurodon.org";
declare option exist:serialize "method=xhtml media-type=application/xhtml+html indent=no";
declare function djb:locus($from as node()?, $to as node()?)
{
(if ($from eq $to)
then
$from/string()
else
if (substring($from, 1, string-length($from) - 1) eq substring($to, 1, string-length($to) - 1))
then
concat($from, '-v')
else
concat($from, '-', $to))
};
declare variable $selection := request:get-parameter("song", 'A82B186b');
declare variable $cantigas := collection('/db/variatio/edition')//tei:div[@type eq 'poem'];
declare variable $song := $cantigas[substring(@corresp, 2) = $selection];
declare variable $author := doc('/db/variatio/ancillary/corpus-autores.xml')//tei:person[string(@xml:id) = $song//tei:name[@role eq 'author']/substring(@ref, 2)];
(<div
class="metadata">
<h2><span
class="pt gl">Cantiga</span><span
class="en">Song</span>
{': ' || string-join($song//tei:title//tei:idno, ', ')}</h2>
<h2><span
class="pt gl">Autor</span><span
class="en">Author</span>
{': ' || $author/tei:persName/string()}</h2>
<h2><span
class="pt gl">Período</span><span
class="en">Period</span>
{': ' || $author/tei:floruit/@from/string()}-{$author/tei:floruit/@to/string()}
(<span
class="pt gl">período</span><span
class="en">period</span>
{' ' || $author/tei:floruit/@period/string()})</h2>
</div>,
<div
class="tabular">
{
for $line in $song//tei:l
return
(<p>{$line/@n/string()}.</p>,
<table>{
for $witness in $song/tei:head/descendant::tei:rdg
let $parameter :=
<parameters>
<param
name="wit"
value="{$witness/@wit}"/>
</parameters>
return
<tr>{transform:transform($line[ancestor::tei:div/tei:head/descendant::tei:rdg/@wit = $witness/@wit], doc('/db/variatio/xslt/table.xsl'), $parameter)}</tr>
}</table>)
}</div>)