Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XSLT Element

XSLT xsl:output Element


XSLT Element Reference Manual Complete XSLT Element Reference Manual


Definition and Usage

xsl:output The element defines the format of the output document.

Note:xsl:output is a top-level element and must be xsl:stylesheet or xsl:transform child node.


Syntax

method="xml|html|text|name"

version="string"

encoding="string"

omit-xml-declaration="yes|no"

standalone="yes|no"

doctype-public="string"

doctype-system="string"

cdata-section-elements="namelist"

indent="yes|no"

media-type="string"/>

property

property Value Description
method xml
 html       

 text       

 name | 可选。定义输出的格式。默认是 XML(但是如果根节点的第一个子节点是 ,且在这之前没有文本节点,则默认是 HTML)。     

Netscape 6 仅支持 "html" 和 "xml"。

|

| version | string | Optional. Sets the W3C version number of the output format. (Used only when method="html" or method="xml"). | | encoding | string | Optional. Sets the value of the encoding attribute in the output. | | omit-xml-declaration | yes
no | Optional. "yes" specifies that the XML declaration () is omitted from the output. "no" specifies that the XML declaration should be included in the output. Default is "no". | | standalone | yes
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. Default is "no".

Netscape 6 does not support this attribute.

| | doctype-public | string | Optional. Specifies the public identifier to use in the DTD. That is, the value of the PUBLIC attribute of the DOCTYPE declaration in the output. | | doctype-system | string | Optional. Specifies the system identifier to use in the DTD. That is, the value of the SYSTEM attribute of the DOCTYPE declaration in the output. | | cdata-section-elements | namelist | Optional. A space-separated list of elements whose text content should be output as CDATA sections. | | indent | yes
no | Optional. "yes" specifies that the output should be indented according to its hierarchical structure. "no" specifies that the output should not be indented according to its hierarchical structure.

Netscape 6 does not support this attribute.

| | media-type | string | Optional. Defines the MIME type of the output (the media type of the data). Default is "text/xml".

Netscape 6 does not support this attribute.

|

Example 1

In this example, the output is an XML document, version 1.0. The character encoding is set to "ISO-8859-1", and the output is indented for greater readability:

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

encoding="iso-8859-1" indent="yes"/>

...

...

Example 2

In this example, the output is an HTML document, version 4.0. The character encoding is set to "ISO-8859-1", and the output is indented for greater readability:

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

encoding="iso-8859-1" indent="yes"/>

...

...


XSLT Element Reference Manual Complete XSLT Element Reference Manual