Handling stylesheet output
The output produced by a stylesheet comes in three forms:
- The principal output.
- Secondary outputs produced by use of
- Messages produced using
Saxon allows applications to control both the destination of the output, and its format.
Three forms of output are recognized:
- Raw output is an arbitrary XDM value.
- Tree output is always a document node, which is formed by wrapping the raw output in an XDM tree using the rules for constructing complex content.
- Serialized output is a string (or octet stream) representing the output as (typically) XML, HTML, or JSON, which may then be written to a file, or perhaps packaged as an HTTP response object to be sent to a browser.
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:
The following sections describe the mechanisms for controlling where stylesheet output is sent and how it is formatted: