module namespace dict = 'http://ossetic-studies.org/ns/abaevdict-site/dictionary';
import module namespace shared = 'http://ossetic-studies.org/ns/abaevdict-site/shared' at '../shared/shared.xq';
import module namespace abv-m = 'http://ossetic-studies.org/ns/abaevdict-mod' at '../../abv-mod.xqm';
(: Sidebar with entry list. Requires abaev.js to be loaded. :)
declare function dict:sidebar($lang as xs:string) {
(
,
,
)
};
declare function dict:main-view($lang as xs:string,
$p as xs:integer,
$xpath as xs:string,
$entry as xs:string) {
(dict:sidebar($lang),
{for $doc at $i in $shared:sorted
where $i > ($p - 1) * $shared:items-per-page and $i <= $p * $shared:items-per-page
let $html := if ($xpath != '' and $entry = $doc/@xml:id)
then abv-m:mark-element(
doc(`abaevdict_{$lang}/xml/{$doc/@xml:id}.xml`),
$xpath) => abv-m:make-html($lang)
else
let $sd := session:get('searchData')
let $sn := session:get('searchN')
return if (exists($sd) and $sd($sn)('entry') = $doc/@xml:id)
then abv-m:make-html($sd($sn)('tei'), $lang)
else doc(`abaevdict_{$lang}/html/{$doc/@xml:id}.html`)
return
{(
(: Block with icons to the left of entry (floating) :)
{
,
if (doc('abaevdict_index/mentioned_en.xml')/lang-index
/lang[@id != 'os' and
not(starts-with(@id,'os-'))]/word/entry[@id=string($doc/@xml:id)])
then }