xsl:output

W3C Working Draft

An XSLT processor may output the result tree as a sequence of bytes, although it is not required to be able to do so (see [16 Conformance]). The xsl:output element allows stylesheet authors to specify how they wish the result tree to be output. If an XSLT processor outputs the result tree, it should do so as specified by the xsl:output element; however, it is not required to do so. The xsl:output element is only allowed as a top-level element. The method attribute on xsl:output identifies the overall method that should be used for outputting the result tree. The value must be a QName. If the QName does not have a prefix, then it identifies a method specified in this document and must be one of xml, html or text. If the QName has a prefix, then it is expanded into a URI reference using the namespace declarations in effect on the xsl:output element; the expanded name identifies the output method; the behavior in this case is not specified by this document. The default for the method attribute is chosen as follows. If the root node has an element child, the expanded name of the first element child of the root node (i.e. the document element) has local part html (in any combination of upper and lower case) and a null namespace URI, and any text nodes preceding the first element child of the root node contain only whitespace characters, then the default output method is html; otherwise, the default output method is xml. The default output method should be used if there are no xsl:output elements or if none of the xsl:output elements specifies a value for the method attribute. The other attributes on xsl:output provide parameters for the output method. The following attributes are allowed: version specifies the version of the output method indent specifies whether the XSLT processor may add additional whitespace when outputting the result tree; the value must be yes or no encoding specifies the preferred character encoding that the XSLT processor should use to encode sequences of characters as sequences of bytes media-type specifies the media type (MIME content type) of the data that results from outputting the result tree; the charset parameter should not be specified explicitly; instead, when the top-level media type is text, a charset parameter should be added according to the character encoding actually used by the output method doctype-system specifies the system identifier to be used in the document type declaration doctype-public specifies the public identifier to be used in the document type declaration xml-declaration specifies whether the XSLT processor should output an XML declaration; the value must be yes or no standalone specifies whether the XSLT processor should output a standalone document declaration; the value must be yes or no cdata-section-elements specifies a list of the names of elements whose text node children should be output using CDATA sections