saxon:new-document

Returns a new document node, with given content.

new-document($content as item()*) ➔ document-node()

Arguments

 

$content

item()*

The content of the new document

Result

document-node()

Namespace

http://saxon.sf.net/

Saxon availability

Requires Saxon-PE or Saxon-EE. Implemented since Saxon 10.

Notes on the Saxon implementation

Available since Saxon 10.

Details

This function constructs a new document node.

The content of the document node (that is, the children of the node) is formed by evaluating the first argument, and applying the rules given in the XSLT 3.0 specification section 5.7.1, Constructing Complex Content.

The base URI of the new document node is taken from the static base URI of the calling expression.

If the function is called twice with the same arguments, it is unpredictable whether it returns the same document node or different document nodes from the two invocations.

It is not required that the resulting document should satisfy the XML rules for a well-formed document; specifically, the node may contain multiple element and text nodes among its children.

See also:

saxon:new-element()

saxon:new-attribute()

saxon:new-text()

saxon:new-comment()

saxon:new-processing-instruction()