Freigeben über


<xsl:output> Element 

Specifies options for use in serializing the result tree.

<xsl:output
  method = "xml" | "html" | "text" | QName 
  version = nmtoken 
  encoding = string
  omit-xml-declaration = "yes" | "no"
  standalone = "yes" | "no"
  doctype-public = string 
  doctype-system = string 
  cdata-section-elements = QNames 
  indent = "yes" | "no"
  media-type = string 
  />

Attributes

  • method
    Identifies the overall method used for outputting the result tree. If there is no prefix, it identifies a method specified in this document that must be one of "xml", "html", "text", or a qualified name (QName) that is not an NCName). If there is a prefix, it is expanded and identifies the output method.

    The default for the method attribute is chosen as follows. If any of the following conditions are true, the default output method is "html":

    • The root node of the result tree has an element child.

    • The expanded-name of the first element child of the root node (that is, the document element) of the result tree has local part "html" (in any combination of uppercase and lowercase) and a null namespace URI.

    • Any text nodes preceding the first element child of the root node of the result tree contain only white space characters.

    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.

    If you are outputting XHTML, it is more effective to set the output method to "xml" instead of "html".

  • version
    Specifies version 1.0 in relation to the "xml" output method; this appears in the output XML declaration as <?xml version="1.0"?>.
  • encoding
    Specifies the preferred character encoding that the parser should use to encode sequences of characters as sequences of bytes. The value of the attribute is treated case-insensitively; it must contain only printable ASCII characters and be a registered character set, or begin with x-.
  • 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.
  • doctype-public
    Specifies the public identifier to be used in the DTD.
  • doctype-system
    Specifies the system identifier to be used in the DTD.
  • cdata-section-elements
    Specifies a list of the Qualified Names of elements whose text node children should be output using CDATA sections.
  • indent
    Specifies additional white space to add when outputting the result tree; the value must be yes or no.
  • media-type
    Specifies the media type (MIME content type) of the data that results from outputting the result tree.

Element Information

Number of occurrences

Unlimited

Parent elements

xsl:stylesheet, xsl:transform

Child elements

(No child elements)

Remarks

A style sheet can contain multiple <xsl:output> elements and can include style sheets that also contain <xsl:output> elements. All the <xsl:output> elements occurring in a style sheet are merged into a single effective <xsl:output> element. It is an error if there is more than one such value for an attribute. 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.

Examples

The following topics provide examples of <xsl:output>.