Created
November 27, 2020 08:14
-
-
Save claudius108/44e26ec506e2a0772f9079b1b67ea5d8 to your computer and use it in GitHub Desktop.
local:create-collections-recursively()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare function local:create-collections-recursively($target-collection-uri as xs:string, $new-collection-path-steps as xs:string*) as xs:string* { | |
if (exists($new-collection-path-steps)) | |
then | |
let $new-collection-name := $new-collection-path-steps[1] | |
let $new-collection-uri := $target-collection-uri || "/" || $new-collection-name | |
return ( | |
if (not(xmldb:collection-available($new-collection-uri))) | |
then xmldb:create-collection($target-collection-uri, $new-collection-name) | |
else () | |
, | |
local:create-collections-recursively($new-collection-uri, subsequence($new-collection-path-steps, 2)) | |
) | |
else () | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment