Loading TOC...

dls:document-version

dls:document-version(
   $uri as xs:string,
   $version-number as xs:unsignedInt
) as document-node()

Summary

This function returns a particular version of a managed document. An error is thrown if there is no such version.

Parameters
$uri The URI of the document.
$version-number The version of the document to be returned.

Required Privileges

The dls-user role is required to run this function, or the privilege:
http://marklogic.com/xdmp/privileges/dls-user

Example

  xquery version "1.0-ml";

  import module namespace dls = "http://marklogic.com/xdmp/dls" 
      at "/MarkLogic/dls.xqy";

  dls:document-update(
           "/foo/bar/baz.xml",
            dls:document-version( "/foo/bar/baz.xml", 1),
            "restoring from version 1", 
            fn:true() )

  (: Restores version 1 of the 'baz.xml' document. :) 
    

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.