Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 58 lines (52 sloc) 2.215 kb
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
xquery version "1.0";
 
declare default element namespace "http://www.tei-c.org/ns/1.0";
declare option exist:serialize "method=xml media-type=application/xml process-xsl-pi=yes indent=yes";
 
let $target := 'xml-stylesheet',
    $content := 'href="kuputei2html.xsl" type="text/xsl" '

return processing-instruction {$target} {$content},
document {
              let $collection := '/db/he_kupu_tawhito/',
                     $kupu := request:get-parameter('kupu', 'mohio'),
                     $reo := request:get-parameter('reo', 'mi'),
                     $kotahi := request:get-parameter('kotahi', 1) cast as xs:decimal,
                     $last := 15 + $kotahi
              return
<TEI>
<teiHeader>
<fileDesc>
<titleStmt> Rapunga: {$kupu} </titleStmt>
<publicationStmt><p><ref target="https://github.com/stuartyeates/He-Kupu-Tawhito">He Kupu Tawhito</ref></p></publicationStmt>
<sourceDesc>
<idno type="url.path">kupu.xql</idno>
<idno type="url.query.kupu">{$kupu}</idno>
<idno type="url.query.reo">{$reo}</idno>
<idno type="url.query.kotahi">{$kotahi}</idno>
</sourceDesc>
</fileDesc>
</teiHeader>
<text>
<body>
<div>
<entry xml:lang="{$reo}" n="{$last}">
<form>
<orth>{$kupu}</orth>
</form>{
                    for $this at $count in subsequence(//p[@n][.//w[@lemma=$kupu][@xml:lang=$reo]], $kotahi, $last)
let $words := $this//w[@lemma=$kupu][@xml:lang=$reo]/@xml:id
                      let $thisid := $this/@xml:id
let $thishash := concat('#', $thisid)
                      let $url := $this/@n
let $others := //p[contains($this/@corresp,@xml:id)][(concat('#',@xml:id)=$this/@corresp) or (concat('#',$this/@xml:id)=@corresp)] |
//p[contains(@corresp,$this/@xml:id)][(concat('#',@xml:id)=$this/@corresp) or (concat('#',$this/@xml:id)=@corresp)]

                      return
                      <cit n="{$url}" corresp="{$words}">
{$this}
{$others}
</cit>
                    }
</entry>

</div>
</body>
</text>
</TEI>
}
Something went wrong with that request. Please try again.