Defines the characteristics of an output document.


Top-level element.

Required Attributes


Optional Attributes


Typically has one of four values: xml, html, xhtml, or text. This value indicates the type of document that is generated. An XSLT processor can add other values to this list; how those values affect the generated document is determined by the XSLT processor. The default value is xml unless the root element of the output document is <html>.

[1.0] In XSLT 1.0, there are only three output methods defined in the standard: xml, html, and text. [2.0] In XSLT 2.0, xhtml has been added as an output method that must be supported by an XSLT processor. Individual processors are still free to add other values as well. To simplify our discussion here, we’ll discuss xhtml as one of the standard output types without constantly reminding you that it’s not available in XSLT 1.0.


Defines the version of the XML, HTML, or XHTML output document. This attribute is ignored with method="text".


The version attribute of the <xsl:output> element works differently from the version attribute that is legal on every XSLT element in XSLT 2.0. See “[2.0] Attributes common to all XSLT elements” earlier in this appendix for more details.


Defines the value of the encoding specified in the XML declaration in the output document. This attribute is ignored with method="text".


Defines whether the XML declaration is omitted in the output document. ...

Get XSLT, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.