XQuery Function Documentation
v:annotate
Return an XML document in which all changes between
$rev and $rev - 1 are annotated.
- Parameters:
-
$doc a node in the document which should be annotated $rev the revision whose changes will be annotated - Returns:
- item()*
v:apply-patch
Apply a given patch on a document. This function is used by v:doc internally.
- Parameters:
-
$doc $doc $diffs* $diffs* - Returns:
- item()*
v:diff
For the document passed as first argument, retrieve the revision
specified in the second argument. Generate a diff between both version,
i.e. HEAD and the given revision. The empty sequence is returned if the
given revision is invalid, i.e. v:doc returns the empty sequence.
- Parameters:
-
$doc a node in the document for which the diff should be generated $rev a valid revision number - Returns:
- element()?
v:doc
Restore a certain revision of a document by applying a
sequence of diffs and return it as an in-memory node. If the
revision argument is empty or smaller than the first actual
revision of the document, the function will return the base
version of the document. If the revision number is greater than
the latest revision, the latest version will be returned.
- Parameters:
-
$doc a node in the document for which a revision should be retrieved. $rev? the revision which should be restored - Returns:
- node()* : a sequence of nodes corresponding to the restored document (TODO: return a document node instead?)
v:find-newer-revision
Check if there are any revisions in the database which are newer than the
version identified by the specified base revision and key. If versioning is
active, the base revision and key are added to the document root element
as attributes whenever a document is serialized. The combination of the two
attributes allows eXist to determine if a newer revision of the document
exists in the database, which usually means that another user/client has
committed it in the meantime.
If one or more newer revisions exist in the database, v:find-newer-revision will
return the version document of the newest revision or an empty sequence
otherwise.
- Parameters:
-
$doc a node in the document which should be checked $base the base revision as provided in the v:revision attribute of the document which was retrieved from the db. $key the key as provided in the v:key attribute of the document which was retrieved from the db. - Returns:
- element()? : a v:version element or the empty sequence if there's no newer revision in the database
v:history
Returns an XML fragment showing the version history of the
document to which the specified node belongs. All revisions
are listed with date and user, but without the detailed diff.
- Parameters:
-
$doc an arbitrary node in a document - Returns:
- element()
v:revisions
- Parameters:
-
$doc $doc - Returns:
- xs:integer*
v:versions
Return all version docs, including the full diff, for the specified
document. This is mainly for internal use.
- Parameters:
-
$doc a node in the document for which revisions should be retrieved. - Returns:
- element()* : zero or more v:version elements describing the changes made in a revision.