XSLT <xsl:output> Element
Definition and Usage
The <xsl:output> element defines the format of the output document.
Note: <xsl:output> is a top-level element and must be a child of <xsl:stylesheet> or <xsl:transform>.
Syntax
Attributes
| Attribute | Value | Description |
|---|---|---|
| method | xml <br>html <br>text <br>name | Optional. Defines the output format. The default is XML (but if the root node's first child is <html> and there are no text nodes before it, the default is HTML). Netscape 6 only supports "html" and "xml". |
| version | string | Optional. Sets the W3C version number of the output format. (Only used when method="html" or method="xml"). |
| encoding | string | Optional. Sets the value of the encoding attribute in the output. |
| omit-xml-declaration | yes <br>no | Optional. "yes" specifies that the XML declaration (<?xml...?>) should be omitted in the output. "no" specifies that the XML declaration should be included in the output. The default is "no". |
| standalone | yes <br>no | Optional. "yes" specifies that the XSLT processor should output a standalone document declaration. "no" specifies that the XSLT processor should not output a standalone document declaration. The default is "no". Netscape 6 does not support this attribute. |
| doctype-public | string | Optional. Specifies the public identifier to be used in the DTD. That is, the value of the PUBLIC attribute in the DOCTYPE declaration in the output. |
| doctype-system | string | Optional. Specifies the system identifier to be used in the DTD. That is, the value of the SYSTEM attribute in the DOCTYPE declaration in the output. |
| cdata-section-elements | namelist | Optional. A space-separated list of elements whose text content should be output as a CDATA section. |
| indent | yes <br>no | Optional. "yes" specifies that the output should be indented according to its hierarchy. "no" specifies that the output should not be indented according to its hierarchy. Netscape 6 does not support this attribute. |
| media-type | string | Optional. Defines the MIME type (media type of the data) of the output. The default is "text/xml". Netscape 6 does not support this attribute. |
Example 1
In this example, the output is an XML document with version 1.0. The character encoding is set to "ISO-8859-1", and the output is indented to enhance readability:
Example 2
In this example, the output is an HTML document with version 4.0. The character encoding is set to "ISO-8859-1", and the output is indented to enhance readability: