The saxon:base64Binary serialization method
Requires Saxon-PE
An additional serialization method saxon:base64Binary
is available. This is intended to be useful when
creating binary output files, for example images. All serialization properties other than method
are
ignored.
As with the text
output method, all nodes in the result tree other than text nodes are ignored. Each text node
must hold a string that is in the lexical space of the xs:base64Binary
data type. The sequence of octets
corresponding to this base64 value is written to the binary output file.
When invoking this method via an API, use the property value "{http://saxon.sf.net/}base64Binary".
When using this serialization method, the omit-xml-declaration
parameter is automatically
set to "yes".
The image here displays as a small red dot. Note that whitespace can be freely inserted into the base64Binary string.
It is of course possible to construct the base64Binary value programmatically. The extension function saxon:octets-to-base64Binary may be useful to achieve this.
When writing output that is not entirely binary, but contains mixed binary and text, it may be more convenient to use the text output method with the saxon:recognize-binary serialization property.
See also the saxon:hexBinary serialization method.