-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestFactbook.xqm
33 lines (28 loc) · 902 Bytes
/
testFactbook.xqm
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
(:~
: ce module est une expérimentation avec les annotations RESTXQ
: @author Philippe Pons et Emmanuel Chateau
:)
module namespace fact = 'http://basex.org/modules/web-page';
declare
%restxq:path("/{$pays}")
function fact:accueil($pays as xs:string) {
let $titre := "titre"
let $fonction := db:open("factbook")//country[string(@name)=$pays]/name
return fact:template($fonction, $titre)
};
(: première modif dans test :)
declare function fact:template($fonction, $titre) as element(Q{http://www.w3.org/1999/xhtml}html) {
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{$titre}</title>
<link rel="stylesheet" type="text/css" href="static/style.css"/>
</head>
<body>
<div class="right"><img src="static/basex.svg" width="96"/></div>
<h2>{$titre}</h2>
<div>
<p>{$fonction}</p>
</div>
</body>
</html>
};