Hi,
given the following RESTXQ function: declare %rest:path("/myrest/{$db}") %rest:GET %output:method("xhtml") %output:omit-xml-declaration("no") %output:doctype-public("-//W3C//DTD XHTML 1.0 Transitional//EN") %output:doctype-system("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd") function page:html($db as xs:string) { <html xmlns="http://www.w3.org/1999/xhtml"> <body> Database creation date: {db:info("NB")/databaseproperties/timestamp/text()}<br/> </body> </html> };
The website returns "Database creation date: " (without a timestamp)
If I put that into a function: declare function page:getDBTimestamp($db as xs:string) { db:info($db)/databaseproperties/timestamp/text() };
and call it in the page: <body> Database creation date: {page:getDBTimestamp($db)}<br/> </body>
then I can see the timestamp.
Can somebody explain to my why it makes a difference and why I cannot query the database directly from the RESTXQ function?
Alex