The <xsl:output> Element

Next, we specify the output method. The XSLT specification defines three output methods: xml, html, and text. We’re creating an HTML document, so HTML is the output method we want to use. In addition to these three methods, an XSLT processor is free to define its own output methods, so check your XSLT processor’s documentation to see if you have any other options:[1]

<xsl:output method="html"/>

A variety of attributes are used with the different output methods. For example, if you’re using method="xml", you can use doctype-public and doctype-system to define the public and system identifiers to be used in the the document type declaration. If you’re using method="xml" or method="html", you can use the indent attribute to control whether or not the output document is indented. The discussion of the <xsl:output> element in Appendix A has all the details.

[1] [2.0] XSLT 2.0 also defines the xhtml output method.

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.