Expand | Collapse

◀ 4. Main stylesheet driver6. Structuring elements ▶

5. HTML document

xsl:stylesheet id="stylesheet" exclude-result-prefixes="x2 lit" version="1.0" xml:lang="en"

document
html
head
title
display-header

Display the HTML body

xsl:template match="/"
  <html>
    xsl:choose
      xsl:when test="x2:html"
        xsl:apply-templates
      
      xsl:when test="x2:section"
        xsl:call-template name="head"
        xsl:call-template name="body"
      
    
  </html>
xsl:template match="x2:html"
  xsl:apply-templates
xsl:template match="x2:title"
  <title>
    xsl:variable name="t"
      xsl:apply-templates
    
    xsl:value-of select="string($t)"
  </title>
xsl:template name="display-header"
  xsl:if test="count($site-map-doc)>0"
    <h1>
      xsl:apply-templates select="$site-map-doc/x2:html/x2:body/x2:h" mode="title-text"
    </h1>
  

5.1. Display the HTML body

This template outputs the HTML body element of the document.

In HTML, the body contains not only what we think as the logical body of the document, but also navigation panels, document headers, footnotes and boilerplate text. Accordingly, these things are output as well in this template.

This template is both a pattern template and a named template, because the input document may or may not have x2:body as its document element.

xsl:template match="x2:body" name="body"
      <body onload="xhtml2to1_onload()" onunload="xhtml2to1_onunload()">
        <div id="_navigation-panel">
          <p>
            <a href="javascript:void()" onclick="xhtml2to1_navigation_expand()">Expand</a> 
            xsl:text | 
            <a href="javascript:void()" onclick="xhtml2to1_navigation_collapse()">Collapse</a> 
          </p>

          <div id="_navigation">
            xsl:call-template name="display-navigation"
          </div>
        </div>
    
        <div id="_body">
          <div id="_header">
            xsl:call-template name="display-page-navigation"
          </div>
    
          xsl:call-template name="display-header"
          xsl:apply-templates
          xsl:call-template name="display-footnotes"

          xsl:call-template name="user-footer"
    
          <div id="_footer">
            xsl:call-template name="display-page-navigation"
              xsl:with-param name="key-bindings" select="true()"
            
          </div>
    
        </div>
      </body>
    

Formatted using xhtml2to1 by Steve Cheng.