XSLT 2.0 serializer PreviousNext

About the XSLT 2.0 serializer

The XSLT serializer is a component designed for the purpose of providing the XSLT engine with a serialization facility, but it can also be used by any other XML-processing program.

Invoking the serializer without using XSLT

To invoke the serializer from a non-XSLT program you must follow the following steps:

  1. Create a descedent of XM_XSLT_SERIALIZER. You will need to provide implementations for the two deferred routines error_listener and encoder_factory. See Overview for more details.
  2. Create an XM_XSLT_OUTPUT_PROPERTIES object. The sole argument for the creation routine is designed for the use of XSLT's xsl:import declaration, to establish import precedence. It seems to me highly unlikely that you will want to use it if you are not using XSLT. Simply pass zero.
  3. Call command from the Element change paragraph to set the serialization options that you want. These are explained in more detail below.
  4. Set up an event stream and feed it to the serializer. This is explained in more detail below.

Setting serialization options

I suggest you point your web browser at Serialization whilst reading this section. You might also look in ${GOBO}/library/xslt/example/serializer.

When you create an XM_XSLT_OUTPUT_PROPERTIES object, the serialization options are identical to those you obtain by default from XSLT - that is, if you do not code an xsl:output declaration in an XSLT transformation. The following features are documented in terms of the attributes on xsl:output to which they correspond. In all cases it is recommended that you pass zero for the import precedence.

Choosing the output method

Generating the XML declaration

Generating the Document Type Declaration

Generating (X)HTML meta tags


Invoking the serializer from the XSLT engine

In order to have the XM_XSLT_TRANSFORMER invoke the serializer, you need to pass an XM_XSLT_TRANSFORMATION_RESULT to the transform command which is created with the creation procedure named make. Almost all examples within Gobo use this feature.

Copyright 2007-2016, Colin Adams and others
Last Updated: 27 December 2016