Nic Miloslav     Example 54    KEYWORDS      EXAMPLES      AUTHORS     

The xsl:output element allows stylesheet authors to specify how they wish the result tree to be output. If an XSLT processor outputs the result tree, it should do so as specified by the xsl:output element; however, it is not required to do so. The xsl:output element is only allowed as a top-level element.Stylesheet 1 outputs as html and Stylesheet 2 as xml. Compare how empty tags are outputed.


     XML     HOME     XSL 1     XSL 2      
<xslTutorial >
<HR> </HR>
<HR></HR>
<HR/>
</xslTutorial>

     XSL 1     HOME     XML     HTML 1     OUTPUT 1     
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output method="html"/>
<xsl:template match="/">
<xsl:copy-of select="/xslTutorial"/>
</xsl:template>
</xsl:stylesheet>

     HTML 1     HOME     XML     XSL 1     OUTPUT 1     
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<xslTutorial>
<HR>
<HR>
<HR> </xslTutorial>

     OUTPUT 1     HOME     XML     XSL 1     HTML 1     




     XSL 2     HOME     XML     HTML 2     OUTPUT 2     
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output method="xml"/>
<xsl:template match="/">
<xsl:copy-of select="/xslTutorial"/>
</xsl:template>
</xsl:stylesheet>

     HTML 2     HOME     XML     XSL 2     OUTPUT 2     
<xslTutorial>
<HR> </HR>
<HR/>
<HR/> </xslTutorial>

     OUTPUT 2     HOME     XML     XSL 2     HTML 2