The serialize() function converts an object to a string as follows:
An empty sequence is converted to an empty string.
A nonempty node-set is converted to a string by serialization of its first node.
A non-attribute XML entity is serialized as if it is serialized by http() function. In other words, the result is a plain text of XML syntax. For an attribute XML entity, the value of attribute is returned.
Values of other types are converted into strings as cast(... as varchar) do this in Virtuoso/PL, exactly.
If the argument is omitted, context node is converted instead as if it is a node-set of one element.
String