共用方式為


Outputs from an XslTransform

Since style sheets can determine the output format using an <xsl:output> statement with the method attribute, the following table describes what the output format is when the Transform method is used to write the output, and the output format is declared as a Stream or TextWriter.

Note

The XslTransform class is obsolete in the .NET Framework 2.0. You can perform Extensible Stylesheet Language for Transformations (XSLT) transformations using the XslCompiledTransform class. See Using the XslCompiledTransform Class and Migrating From the XslTransform Class for more information.

Since style sheets can determine the output format using an <xsl:output> statement with the method attribute, the following table describes what the output format is when the Transform method is used to write the output, and the output format is declared as a Stream or TextWriter. The following table describes what happens when an output type is declared by the Transform method in conjunction with the use of an <xsl:output> statement:

<xsl:output method = > attribute Result format
method="xml" XML
method="html" HTML
method="text" Text

Note

Note: The <xsl:output> statement is ignored when the output of the Transform method is an XmlReader or XmlWriter.

The following attributes are supported when the Transform method output is a Stream or TextWriter:

  • encoding*

  • omit-xml-declaration

  • standalone

  • doctype-public

  • doctype-system

  • cdata-section-elements

  • indent

    Note

    *The encoding attribute is ignored when the Transform method is sending its output to a TextWriter. The encoding property on the TextWriter is used instead.

The following attribute is ignored when the Transform method output is a Stream:

  • version: the version is always 1.0

  • media-type: the media-type

Escaping Special Characters

The <xsl:text disable-output-escaping> tag is used to indicate whether or not special characters need to be escaped into an XML form (for example, using <&lt> in place of the "<" symbol) or left in the present condition. The disable-output-escaping attribute is ignored when transforming to an XmlReader or XmlWriter object and has no effect on special characters.

See also