xsl:output

Specifies the output for the result tree.

Format

<xsl:output attribute_list /> 

Description

The xsl:output instruction specifies how you want the result tree to be output. However, if you use the XSLT processor to format the result as a string, or to generate DOM nodes, the xsl:output instruction has no effect.

If you specify the xsl:output instruction, the XSLT processor outputs the result tree according to your specification. If you specify it, the xsl:output instruction must be a top-level element.

The attribute list can include the method attribute. The method attribute identifies the overall method you want the XSLT processor to use to output the result tree. The value must be xml, html, or text.

Note that the XSLT processor formats the results of applying the stylesheet. If your stylesheet generates XML or HTML that does not follow all syntax rules, the XSLT processor does not do anything to fix this. For example, if a stylesheet generates multiple root elements, the XSLT processor neither fixes this nor generates an error. You receive a string, and it is only upon examination or use of the string that you would learn that it is not well-formed XML.

If you do not specify an xsl:output instruction that includes the method attribute, the XSLT processor chooses a default as follows:

The other attributes that you can specify in attribute_list provide parameters for the output method. You can specify the following attributes:

The XSLT processor ignores this attribute when the output method is text.

A stylesheet can include multiple xsl:output elements. The XSLT processor effectively merges multiple xsl:output elements into one xsl:output element. If there are multiple values for the same attribute, the XSLT processor uses the last specified value.

In this release, the XSLT processor ignores the following attributes:

 
Free Stylus Studio XML Training: