declare default element namespace "
http://www.bibletechnologies.net/2003/OSIS/namespace";
declare default function namespace "
http://www.w3.org/2005/xquery-local-functions";
declare function local:get-ketiv($base, $catchword)
{
let $prev := $base/preceding-sibling::*[1]
let $prevstring := fn:string($prev)
where $prev and fn:ends-with($catchword, $prevstring)
return (
$prev
,
if ($prevstring != $catchword)
then get-ketiv($prev, fn:substring($catchword, 1, fn:string-length($catchword) - fn:string-length($prevstring)))
else ()
)
};
declare updating function local:mark-ketiv($variant)
{
for $ketiv in get-ketiv($variant, $variant/catchWord)
return (
delete node $ketiv/@type,
insert node attribute type { fn:string-join(($ketiv/@type, "x-ketiv")," ") } into $ketiv
)
};
let $oshb := db:open("oshb-morphology")
for $verse in $oshb//verse[note[@type='variant']]
for $variant in $verse/note[@type='variant']
return mark-ketiv($variant)
I really appreciate all your help with this!
Jonathan