Handling stylesheet output

The output produced by a stylesheet comes in three forms:

Saxon allows applications to control both the destination of the output, and its format.

Three forms of output are recognized:

For example, given a stylesheet whose initial template is:

<xsl:template match="/"> <xsl:sequence select="1 to 5"/> </xsl:template>

the raw output is a sequence of five integers; the tree output is an in-memory XML document fragment holding a single text node whose string value is "1 2 3 4 5", and the serialized output (assuming the XML output method) might be:

<?xml version="1.0" encoding="utf-8">1 2 3 4 5

The following sections describe the mechanisms for controlling where stylesheet output is sent and how it is formatted: