output

The output is a root level instruction (within the stylesheet element) that controls the characteristics of the output document. Only one declaration of this element is allowed.

Syntax
<output> ::= “output” “{” ( “method” ( “xml” | “html” | “text” ) | “version” <version number> | “encoding” ( “UTF-8” | “UTF-16” | · · · ) | “omit-xml-declaration” ( “yes” | “no” )? | “indent” ( ( “yes” | “no” ) )? | “doctype-system” <quote> <DTD> <quote> | “doctype-public” <quote> <DTD> <quote> | “cdata-section-elements” <quote> <cdata list> <quote> )* “}”
Options

None.

Elements

The range of values within an output block is identical to the XSLT definition.

method Specifies the output format (currently only "xml", "html" or "text").
version Specifies the value of the version attribute of the XML or HTML declaration in the output document. This attribute should only be used when method is "xml" or "html".
encoding Specifies the text encoding to be used: UTF-8, etc.
omit-xml-declaration Specifies whether the XSLT processor should output an XML declaration; permissible values are "yes" or "no".
standalone Specifies whether the XSLT processor should output a standalone document declaration; permissible values are "yes" or "no".
indent Specifies whether the XSLT processor may add additional whitespace when outputting the result tree; permissible values are "yes" or "no".
doctype-public specifies the public identifier to be used in the document type declaration.
doctype-system specifies the system identifier to be used in the document type declaration.
cdata-section-elements Specifies a list of the names of elements whose text node children should be output using CDATA sections.
media-type Specifies the media type (MIME content type) of the data that results from outputting the result tree.
Examples

Setting a set of output selections.

stylesheet { version "1.0" output { doctype-public "-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" method xml version "1.1" encoding "UTF-16" } }

compiles to

<?xml version="1.0" encoding="UTF-8"?> <stylesheet xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0"> <output doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" method="xml" version="1.1" encoding="UTF-16"/> </stylesheet>
Errors

Most of the errors here are self-explanatory. For example

stylesheet { version "1.0" output { doctype-public "-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" method xm version "1.1" encodng "UTF-16" } }

will give the error

**** (106) Unexpected symbol "xm" in line 7 Check spelling, did you mean "xml" ? **** (106) Unexpected symbol "encodng" in line 9 Check spelling, did you mean "encoding" ?
Copyright 2024 Hugh Field-Richards. All Rights Reserved.