当前位置: 首页 > 网络学院 > XML相关教程 > XSL/XSLT > XSLT <xsl:output> 元素

XSL/XSLT
XSL 语言
XSLT 介绍
XSLT 浏览器
XSLT 转换
<xsl:template>
<xsl:value-of>
<xsl:for-each>
<xsl:sort>
<xsl:if>
<xsl:choose>
<xsl:apply-templates>
XSLT - 客户端
XSLT - 服务器端
XSLT - 编辑XML
XSLT 摘要
XSLT 元素参考
XSLT 函数
XSL 编辑器

XSL/XSLT 中的 XSLT <xsl:output> 元素


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 289 ::
收藏到网摘: n/a

Definition and Usage
定义和用法

The <xsl:output> element defines the format of the output document.
<xsl:output>元素定义了输出文档的格式。

Note: <xsl:output> is a top-level element, and must appear as a child node of <xsl:stylesheet> or <xsl:transform>.
注意:<xsl:output>是顶级元素,它必须以<xsl:stylesheet>或<xsl:transform>子节点的形式出现。


Syntax
语法

<xsl:output
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"/>

Attributes
属性

属性 描述
method xml
html
text
name

Optional. Defines the output format. The default is XML (but if the first child of the root node is <html> and there are no preceding text nodes, then the default is HTML)

可选参数。定义输出文档的格式。默认值为XML(但是,如果根节点的第一个子节点是<html>,并且不包含任何前置文本节点,那么此时默认值为HTML)

Netscape 6 only supports "html" and "xml"
Netscape 6 仅支持 "html" 和 "xml"

version string Optional. Sets the W3C version number for the output format (only used with method="html" or method="xml")
可选参数。为输出文档的格式设置W3C的版本号(仅能使用method="html"或method="xml")
encoding string Optional. Sets the value of the encoding attribute in the output
可选参数。在输入文档中设置encoding[编码]属性值
omit-xml-declaration yes
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"
可选参数。“yes”指定了XML声明(<?xml...?>)应该在输出文档中忽略;“no” 指定了XML声明必须包括在输出文档中。默认值是no
standalone yes
no

Optional. "yes" specifies that a standalone declaration should occur in the output. "no" specifies that a standalone declaration should not occur in the output. The default is "no"

可选参数。 "yes"指定了一个孤立的声明将出现在输出文档中;"no"指定了一个孤立的声明将不出现在输出文档中。默认值为no

This attribute is not supported by Netscape 6
Netscape 6不支持该属性

doctype-public string Optional. Sets the value of the PUBLIC attribute of the DOCTYPE declaration in the output
可选参数。将DOCTYPE 声明中的PUBLIC属性值设置在输出文档中
doctype-system string Optional. Sets the value of the SYSTEM attribute of the DOCTYPE declaration in the output
可选参数。将DOCTYPE 声明中的SYSTEM属性值设置在输出文档中
cdata-section-elements namelist Optional. A white-space separated list of elements whose text contents should be written as CDATA sections
可选参数。指定一个针对元素的空行分隔符,该元素文本内容将以CDATA片断的形式书写
indent yes
no

Optional. "yes" indicates that the output should be indented according to its hierarchic structure. "no" indicates that the output should not be indented according to its hierarchic structure.

可选参数。"yes"指定输出文档应该根据主文档结构进行缩进。"no"指定输出文档不根据主文档结构进行缩进。

This attribute is not supported by Netscape 6
Netscape 6不支持该属性

media-type string

Optional. Defines the MIME type of the output. The default is "text/xml"

可选参数。定义了输出文档的MIME类型。默认值为“text/xml”

This attribute is not supported by Netscape 6
Netscape 6不支持该属性

Example 1
案例1

The output in this example will be an XML document, version 1.0. The character encoding is set to "ISO-8859-1" and the output will be indented for readability:
案例中的输出文档是一个1.0.版本的XML文档。该字符编码被设置为 "ISO-8859-1",输出文档将根据实际阅读情况进行缩进,具体如下:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0"
encoding="iso-8859-1" indent="yes"/>
...
...
</xsl:stylesheet>

Example 2
案例2

The output in this example will be an HTML document, version 4.0. The character encoding is set to "ISO-8859-1" and the output will be indented for readability:
案例中的输出文档是一个4.0.版本的HTML文档。该字符编码被设置为 "ISO-8859-1",输出文档将根据实际阅读情况进行缩进,具体如下:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="4.0"
encoding="iso-8859-1" indent="yes"/>
...
...
</xsl:stylesheet>

评论 (0) All

登陆 | 还没注册?