searchDocByTitle.xqm 564 Bytes
Newer Older
simei.yin's avatar
simei.yin committed
1
2
3
4
5
6
7
8
9
10
11
12
13
(: This script will return documents by searching one keyword in their title :)
(: We can assign a Regular Expression to the variable $name :)
(: For example, $name := '^NF29_HdocEtherpad$', to search for an exact name:)
(: For example, $name := 'NF29', to search for documents whose name contains 'NF29':)

module namespace myNs = "https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex";

declare function myNs:searchDocByTitle($name as xs:string, $docs as node()*) as node()*
{
  for $doc in $docs
  where matches($doc/titre, $name, "i")
  return $doc
};