Literal Result Elements
Any elements in the stylesheet other than those listed above are assumed to be literal result elements, and are copied to the current output stream at the position in which they occur.
Any of the standard attributes defined in XSLT may appear on literal result elements, but
in this case the names of the attributes must be in the XSLT namespace. Thus they are
typically written with the xsl
prefix: xsl:default-collation
,
xsl:default-mode
, xsl:default-validation
,
xsl:exclude-result-prefixes
, xsl:expand-text
,
xsl:extension-element-prefixes
, xsl:use-when
,
xsl:version
, and xsl:xpath-default-namespace
. For details
about these standard attributes, see xsl:stylesheet.
Attribute values within literal result elements are treated as attribute value templates: they may contain string expressions enclosed between curly braces. For the syntax of string expressions, see xsl:value-of.
Where the output is HTML, certain formatting elements are recognised as empty elements:
these are AREA
, BASEFONT
, BR
, COL
,
FRAME
, HR
, IMG
, INPUT
,
ISINDEX
, LINK
, META
, and SYSTEM
(in either upper or lower case, and optionally with attributes, of course). These should
be written as empty XML elements in the stylesheet, and will be written to the HTML
output stream without a closing tag.
With HTML output, if the attribute name is the same as its value, the abbreviated form of
output is used: for example if <OPTION SELECTED="SELECTED">
appears
in the stylesheet, it will be output as <OPTION SELECTED>
.
A simple stylesheet may be created by using a literal result element as the top-level
element of the stylesheet. This implicitly defines a single template with a match
pattern of /
. In fact, an XHTML document constitutes a valid stylesheet
which will be output as a copy of itself, regardless of the contents of the source XML
document.