I have the following .xquery file.
xquery version "3.0";
declare namespace xmldb="http://exist-db.org/xquery/xmldb";
(: the output will be presented as html :)
declare option exist:serialize "method=html media-type=text/html indent=yes";
let $something:=""
return
<html>
<head>Stackoverflow rocks!</head>
<body>
<div>
<h1>HELLO WORLD!</h>
</div>
</body>
</html>
How can I bind the returned HTML page to $variable
in order to store it using this expression:
let $store:=xmldb:store('/db/apps/mycollection','page.html',$variable)
return
$store
How about something like the following (not tested)?
xquery version "3.0";
declare namespace xmldb="http://exist-db.org/xquery/xmldb";
(: the output will be presented as html :)
declare option exist:serialize "method=html media-type=text/html indent=yes";
let $doc :=
<html>
<head>Stackoverflow rocks!</head>
<body>
<div>
<h1>HELLO WORLD!</h>
</div>
</body>
</html>,
$store := xmldb:store('/db/apps/mycollection',
'page.html',
$doc)
return if ($store eq '') then
'Sorry, attempted to store document but failed.'
else
concat('Stored document at ', $store)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.