http://zorba.io/modules/store/dynamic/collections/w3c/dml

View as XML or JSON.

This modules provides a set of functions to modify a collection and retrieve the nodes contained in a particular collection.

Such collections are identified by a URI as defined in the XQuery specification. However, please note that we do not advice users to use collections identified by URIs. Instead, we refer to the data lifecycle documentation. It gives an overview of several ways to work with collections, documents, and other data-structures.

Function Summary

apply-insert-nodes-after ($name as xs:string, $pos as node(), $content as node()*) as node()*

This function does the same as the insert-nodes-after() function except it immediately applies the resulting pending updates and returns the nodes that have been inserted.

apply-insert-nodes-before ($name as xs:string, $target as node(), $content as node()*) as node()*

This function does the same as the insert-nodes-before() function except it immediately applies the resulting pending updates and returns the nodes that have been inserted.

apply-insert-nodes-first ($name as xs:string, $content as node()*) as node()*

This function does the same as the insert-nodes() function except it immediately applies the resulting pending updates and returns the nodes that have been inserted.

apply-insert-nodes-last ($name as xs:string, $content as node()*) as node()*

This function does the same as the insert-nodes-last() function except it immediately applies the resulting pending updates and returns the nodes that have been inserted.

collection-name ($node as node()) as xs:string

Gets the name of the collection the given node belongs to.

collection ($name as xs:string) as node()*

Gets the sequence of nodes of the collection identified by the given name.

delete-node-first ($name as xs:string)

Deletes the first node from a collection.

delete-node-last ($name as xs:string)

Deletes the last node from a collection.

delete-nodes-first ($name as xs:string, $number as xs:integer)

Deletes the first N nodes from a collection.

delete-nodes-last ($name as xs:string, $number as xs:integer)

Deletes the last N nodes from a collection.

delete-nodes ($nodes as node()*)

Deletes nodes from a collection.

index-of ($node as node()) as xs:integer

Gets the index of the given node in the collection.

insert-nodes-after ($name as xs:string, $pos as node(), $content as node()*)

Inserts copies of the given nodes into a collection at the position directly following the given target node.

insert-nodes-before ($name as xs:string, $target as node(), $content as node()*)

Inserts copies of the given nodes into a collection at the position directly preceding the given target node.

insert-nodes-first ($name as xs:string, $content as node()*)

Inserts copies of the given nodes at the beginning of the collection.

insert-nodes-last ($name as xs:string, $content as node()*)

Inserts copies of the given nodes at the end of the collection.

Functions

apply-insert-nodes-after#3

declare  %an:sequential function dml:apply-insert-nodes-after($name as xs:string, $pos as node(), $content as node()*) as node()*
This function does the same as the insert-nodes-after() function except it immediately applies the resulting pending updates and returns the nodes that have been inserted.

Parameters

name as xs:string
The name of the collection to insert into.
pos as node()
content as node()
The sequence of nodes whose copies will be inserted.

Returns

node()*
The sequence of nodes that have been inserted.

apply-insert-nodes-before#3

declare  %an:sequential function dml:apply-insert-nodes-before($name as xs:string, $target as node(), $content as node()*) as node()*
This function does the same as the insert-nodes-before() function except it immediately applies the resulting pending updates and returns the nodes that have been inserted.

Parameters

name as xs:string
The name of the collection to insert into.
target as node()
The node in the collection before which $content will be inserted.
content as node()
The sequence of nodes whose copies will be inserted.

Returns

node()*
The sequence of nodes that have been inserted.

apply-insert-nodes-first#2

declare  %an:sequential function dml:apply-insert-nodes-first($name as xs:string, $content as node()*) as node()*
This function does the same as the insert-nodes() function except it immediately applies the resulting pending updates and returns the nodes that have been inserted.

Parameters

name as xs:string
The name of the collection to insert into.
content as node()
The sequence of nodes whose copies will be inserted.

Returns

node()*
The sequence of nodes that have been inserted.

apply-insert-nodes-last#2

declare  %an:sequential function dml:apply-insert-nodes-last($name as xs:string, $content as node()*) as node()*
This function does the same as the insert-nodes-last() function except it immediately applies the resulting pending updates and returns the nodes that have been inserted.

Parameters

name as xs:string
The name of the collection to insert into.
content as node()
The sequence of nodes whose copies will be inserted.

Returns

node()*
The sequence of nodes that have been inserted.

collection-name#1

declare  function dml:collection-name($node as node()) as xs:string
Gets the name of the collection the given node belongs to.

Parameters

node as node()
The node for which to get the name of the collection.

Returns

xs:string
The URI of the collection to which $node belongs.

collection#1

declare  function dml:collection($name as xs:string) as node()*
Gets the sequence of nodes of the collection identified by the given name.

Parameters

name as xs:string
The name of the collection.

Returns

node()*
The sequence contained in the given collection.

delete-node-first#1

declare  function dml:delete-node-first($name as xs:string)
Deletes the first node from a collection.

Parameters

name as xs:string
The name of the collection to delete from.

Returns

An empty XDM instance and a pending update list that, once applied, deletes the first node from the collection.

delete-node-last#1

declare  function dml:delete-node-last($name as xs:string)
Deletes the last node from a collection.

Parameters

name as xs:string
The name of the collection to delete from.

Returns

An empty XDM instance and a pending update list that, once applied, deletes the last node from the collection.

delete-nodes-first#2

declare  function dml:delete-nodes-first($name as xs:string, $number as xs:integer)
Deletes the first N nodes from a collection.

Parameters

name as xs:string
The name of the collection to delete from.
number as xs:integer
The number of nodes to delete.

Returns

An empty XDM instance and a pending update list that, once applied, deletes the nodes from the collection.

delete-nodes-last#2

declare  function dml:delete-nodes-last($name as xs:string, $number as xs:integer)
Deletes the last N nodes from a collection.

Parameters

name as xs:string
The name of the collection to delete from.
number as xs:integer
The number of nodes to delete.

Returns

An empty XDM instance and a pending update list that, once applied, deletes the last n nodes.

delete-nodes#1

declare  function dml:delete-nodes($nodes as node()*)
Deletes nodes from a collection.

Parameters

nodes as node()
the nodes in the collection that should be deleted.

Returns

An empty XDM instance and a pending update list that, once applied, deletes the nodes from their collections.

index-of#1

declare  function dml:index-of($node as node()) as xs:integer
Gets the index of the given node in the collection.

Parameters

node as node()
The node to get the index of.

Returns

xs:integer
Returns the position of $node in the collection.

insert-nodes-after#3

declare  function dml:insert-nodes-after($name as xs:string, $pos as node(), $content as node()*)
Inserts copies of the given nodes into a collection at the position directly following the given target node.

Parameters

name as xs:string
The name of the collection to insert into.
pos as node()
content as node()
The sequence of nodes whose copies will be inserted.

Returns

An empty XDM instance and a pending update list that, once applied, inserts the nodes into the collection.

insert-nodes-before#3

declare  function dml:insert-nodes-before($name as xs:string, $target as node(), $content as node()*)
Inserts copies of the given nodes into a collection at the position directly preceding the given target node.

Parameters

name as xs:string
The name of the collection to insert into.
target as node()
The node in the collection before which $content will be inserted.
content as node()
The sequences of nodes whose copies will be inserted.

Returns

An empty XDM instance and a pending update list that, once applied, inserts the nodes into the collection.

insert-nodes-first#2

declare  function dml:insert-nodes-first($name as xs:string, $content as node()*)
Inserts copies of the given nodes at the beginning of the collection.

Parameters

name as xs:string
The name of the collection to insert into.
content as node()
The sequence of nodes whose copies will be inserted.

Returns

An empty XDM instance and a pending update list that, once applied, inserts $content into the collection.

insert-nodes-last#2

declare  function dml:insert-nodes-last($name as xs:string, $content as node()*)
Inserts copies of the given nodes at the end of the collection.

Parameters

name as xs:string
The name of the collection to insert into.
content as node()
The sequence of nodes whose copies will be inserted.

Returns

An empty XDM instance and a pending update list that, once applied, inserts the nodes into the collection.