Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
TriggerExample: Shared Library module with a common function
xquery version '1.0-ml';
(: common util module :)
xdmp:document-insert("/SAMPLE/MODULE/sample-library.xqy",
text{ '
xquery version "1.0-ml";
module namespace minilibrary = "minilib";
declare variable $dnamespace := "http://www.sample.net/schema/datahub";
declare function get-metadata() as node() {
let $isoFormat := "[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01][Z]"
let $currentTS := current-dateTime()
let $currentISO := format-dateTime($currentTS, $isoFormat)
let $metadataCreated := element{QName($dnamespace, "createdTS") } {$currentISO}
return $metadataCreated
};'
}, xdmp:permission('app-user', 'execute'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment