Top-level elements

Top-level elements

The elements described in this section can appear only as children of the root xsl:stylesheet element. They specify options that affect the entire translation of the input file to the output.


xsl:output: Select output options
xsl:preserve-space: Preserving white space
 xsl:strip-space: Removing non-significant white space
xsl:import: Use templates from another stylesheet
xsl:key: Create an index to optimize input document access
xsl:decimal-format: Define a numeric format

This optional tag defines what tag format to use in the output file. The default is XML format. This tag must be a child of the root xsl:stylesheet element.

Attributes include:


    Values include xml for XML output; html for output as HTML; and text if the output is just ordinary text, not tagged.

    Identifies the version of the output method.

    If the output method is XML, a <?xml...?> processing instruction is written to the output file unless you specify omit-xml-declaration="yes". The default is "no". No XML declaration is written for the other output methods.

    Use indent="yes" to request that XML or HTMl output be indented. Some XSLT processors may not support this option.

    Specifies the character encoding that will appear in the XML processing instruction, if one is generated. Examples: ISO-8859-1, UTF-8.

    Use this attribute to add a <!DOCTYPE> declaration to generated HTML or XML.

    If you want to generate a SYSTEM document type, set this attribute to the URI containing the DTD.

    If you want to generate a <!DOCTYPE> declaration using a public identifier, set this attribute to the public identifier and also set the doctype-system attribute to the URI corresponding to that public identifier.

Here is an example of an xsl:output element for generating strict XHTML 1.0:

<xsl:output method="xml" encoding="ISO-8859-1" indent="yes"
    doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"

The file generated with these output options will start like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
    "-//W3C//DTD XHTML 1.0 Strict//EN"