Skip to content
Snippets Groups Projects
Commit 4dbfae09 authored by Peter Stadler's avatar Peter Stadler
Browse files

added function `wega-util-shared:order-by-cert()`

parent 9ff9f589
No related branches found
No related tags found
No related merge requests found
...@@ -47,3 +47,25 @@ declare function wega-util-shared:guess-mimeType-from-suffix($suffix as xs:strin ...@@ -47,3 +47,25 @@ declare function wega-util-shared:guess-mimeType-from-suffix($suffix as xs:strin
case 'txt' return 'text/plain' case 'txt' return 'text/plain'
default return () default return ()
}; };
(:~
: Sort TEI elements by their cert-attribute (e.g. <tei:date cert="medium"/>)
: NB: items without cert-attribute will rank the highest, followed by 'high', 'medium', 'low', 'unknown'
:
: @param $items the items to sort
: @return the sorted sequence of the items
~:)
declare function wega-util-shared:order-by-cert($items as item()*) as item()* {
let $order := map {
'high' := 1,
'medium' := 2,
'low' := 3,
'unknown' := 4,
'' := 0
}
return
for $i in $items
let $cert := $i/string(@cert)
order by $order($cert)
return $i
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment