fn:serialize

This function serializes the supplied node $arg, returning the serialized node as a string.

serialize($arg as node()) ➔ xs:string

Arguments

 

$arg

node()

The node (typically a document or element node) to be serialized

Result

xs:string

serialize($arg as node(), $params as node()*) ➔ xs:string

Arguments

 

$arg

node()

The node (typically a document or element node) to be serialized

 

$params

node()*

Serialization parameters

Result

xs:string

Namespace

http://www.w3.org/2005/xpath-functions

Links to W3C specifications

XPath 3.0 Functions and Operators

Notes on the Saxon implementation

This function is specified in XPath 3.0, and is available since Saxon 9.3, provided XPath 3.0 is enabled. It replaces the Saxon extension function saxon:serialize.

In Saxon 9.5 the implementation is changed to match the 2011 version of the serialization specification. Note bug 16745 which points out that the example of fn:serialize in the Functions and Operators specification is incorrect.

Saxon 9.3 and Saxon 9.4 implemented the 2009 version of the specification, in which the serialization parameters were supplied without a wrapper element: see here.