fn:serialize

This function serializes the supplied input sequence $arg, returning the serialized representation of the sequence as a string.

serialize($arg as item()*) ➔ xs:string

Arguments

 

$arg

item()*

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

Result

xs:string

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

Arguments

 

$arg

item()*

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

 

$params

item()?

Serialization parameters

Result

xs:string

Namespace

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

Links to W3C specifications

XPath 3.0 Functions and Operators

XPath 3.1 Functions and Operators

Notes on the Saxon implementation

Since XPath 3.1 (implemented in Saxon 9.7), the serialization parameters may be supplied as a map, or as an output:serialization-parameters element; see the specification for details. See xsl:output for more information on serialization parameters.

The function is available since Saxon 9.3, provided XPath 3.0 is enabled. It replaces the Saxon extension function saxon:serialize. 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. In Saxon 9.5 the implementation was changed to match the 2011 version of the serialization specification.