An "xsl:output" element allows the stylesheet authors to specify how do they wish a
result tree to be output. If the XSL processor outputs a result tree, it must
do so as specified by a xsl:output element; however, it is required not to do so.
An xsl:output element is allowed only as the top-level element.
outputs as html
When xml:output element is not present the default output method is "xml"
(see to XSL stylesheet 1 ), And if the document element of output has a value "html"
which is case insensitive and it does not have the 'xmlns' attribute, then the html
method is made used
An html output method must not output the end-tag for an empty elements specified in
the HTML specification. An html output method must not perform the escaping for a content
of the script and also the style elements.
XML Source
<source>
<h1> HTML output </h1>
<AAA/>
<HR/>
<script>if (a < b) foo(); if (cc < dd) foo() </script>
<hr/>
<hr/>
<Hr/>
<hR/>
</source>
Output
<h1> HTML output </h1>
<AAA></AAA>
<HR><script>if (a < b) foo();
if (cc < dd) foo()
</script><hr>
<hr>
<Hr>
<hR>
Encoding attribute do specify the preferred encoding to be made used. An html output
method must add the META element immediately after start-tag of HEAD element
specifying a character encoding actually been used. XSL stylesheet 1 outputs in the UTF-8,
An xml source do contains the characters which are not present in the specified character
set and they are therefore been escaped.
A text output method outputs result tree by outputting a string-value of every
text node in a result tree in the document order without doing any escaping.
XML Source
<source>
<AAA id="12"/>
</source>
Output
<!ELEMENT AAA ANY><!ATTLIST AAAid ID #REQUIRED>Look at my source in your browser
XSL stylesheet
<xsl:stylesheet version = '1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output method="text"/>
<xsl:template match="AAA">
<xsl:text><!ELEMENT </xsl:text>
<xsl:value-of select="name()"/>
<xsl:text> ANY></xsl:text>
<xsl:text><!ATTLIST </xsl:text>
<xsl:value-of select="name()"/>
<xsl:text/>
<xsl:value-of select="name(@*)"/>
<xsl:text> ID #REQUIRED></xsl:text>
<xsl:text>Look at my source in your browser</xsl:text>
</xsl:template>
</xsl:stylesheet>