16 Output
Output
<
output
method=
qname-but-not-ncname
version=
nmtoken
encoding=
string
omit-xml-declaration=
standalone=
doctype-public=
string
doctype-system=
string
cdata-section-elements=
qnames
indent=
media-type=
string
>
<-- Content: -->
<
/output>
An XSLT processor may output the result tree as a sequence of
bytes, although it is not required to be able to do so (see [Conformance]). The xsl:output element allows
stylesheet authors to specify how they wish the result tree to be
output. If an XSLT processor outputs the result tree, it should do so
as specified by the xsl:output element; however, it is
not required to do so.
The xsl:output element is only allowed as a Top-level element.
The method attribute on xsl:output
identifies the overall method that should be used for outputting the
result tree. The value must be a QName. If the QName does not have a prefix, then it
identifies a method specified in this document and must be one of
xml, html or text. If the QName has a prefix, then the QName is expanded into an expanded-name as described
in [Qualified Names]; the expanded-name identifies the output
method; the behavior in this case is not specified by this
document.
The default for the method attribute is chosen as
follows. If
-
the root node of the result tree has an element
child,
-
the expanded-name of the first element child of the root node
(i.e. the document element) of the result tree has local part
html (in any combination of upper and lower case) and a
null namespace URI, and
-
any text nodes preceding the first element child of the root
node of the result tree contain only whitespace characters,
then the default output method is html; otherwise, the
default output method is xml. The default output method
should be used if there are no xsl:output elements or if
none of the xsl:output elements specifies a value for the
method attribute.
The other attributes on xsl:output provide parameters
for the output method. The following attributes are allowed:
-
version specifies the version of the output
method
-
indent specifies whether the XSLT processor may
add additional whitespace when outputting the result tree; the value
must be yes or no
-
encoding specifies the preferred character
encoding that the XSLT processor should use to encode sequences of
characters as sequences of bytes; the value of the attribute should be
treated case-insensitively; the value must contain only characters in
the range #x21 to #x7E (i.e. printable ASCII characters); the value
should either be a charset registered with the Internet
Assigned Numbers Authority [IANA], [RFC2278] or start with X-
-
media-type specifies the media type (MIME
content type) of the data that results from outputting the result
tree; the charset parameter should not be specified
explicitly; instead, when the top-level media type is
text, a charset parameter should be added
according to the character encoding actually used by the output
method
-
doctype-system specifies the system identifier
to be used in the document type declaration
-
doctype-public specifies the public identifier
to be used in the document type declaration
-
omit-xml-declaration specifies whether the XSLT
processor should output an XML declaration; the value must be
yes or no
-
standalone specifies whether the XSLT processor
should output a standalone document declaration; the value must be
yes or no
-
cdata-section-elements specifies a list of the
names of elements whose text node children should be output using
CDATA sections
The detailed semantics of each attribute will be described
separately for each output method for which it is applicable. If the
semantics of an attribute are not described for an output method, then
it is not applicable to that output method.
A stylesheet may contain multiple xsl:output elements
and may include or import stylesheets that also contain
xsl:output elements. All the xsl:output
elements occurring in a stylesheet are merged into a single effective
xsl:output element. For the
cdata-section-elements attribute, the effective value is
the union of the specified values. For other attributes, the
effective value is the specified value with the highest Import Precedence. It is an error
if there is more than one such value for an attribute. An XSLT
processor may signal the error; if it does not signal the error, if
should recover by using the value that occurs last in the stylesheet.
The values of attributes are defaulted after the
xsl:output elements have been merged; different output
methods may have different default values for an attribute.
|