]> granicus.if.org Git - docbook-dsssl/commitdiff
Check in beta2 epub3 development files.
authorBob Stayton <bobs@sagehill.net>
Thu, 22 Sep 2011 10:32:04 +0000 (10:32 +0000)
committerBob Stayton <bobs@sagehill.net>
Thu, 22 Sep 2011 10:32:04 +0000 (10:32 +0000)
xsl/xhtml5/chunk.xsl [new file with mode: 0644]
xsl/xhtml5/chunkfast.xsl [new file with mode: 0644]
xsl/xhtml5/docbook.css.xml [new file with mode: 0644]
xsl/xhtml5/docbook.xsl [new file with mode: 0644]
xsl/xhtml5/html5-chunk-mods.xsl [new file with mode: 0644]
xsl/xhtml5/html5-element-mods.xsl [new file with mode: 0644]
xsl/xhtml5/onechunk.xsl [new file with mode: 0644]
xsl/xhtml5/profile-chunk.xsl [new file with mode: 0644]
xsl/xhtml5/profile-docbook.xsl [new file with mode: 0644]
xsl/xhtml5/xhtml-docbook.xsl [new file with mode: 0644]
xsl/xhtml5/xhtml-profile-docbook.xsl [new file with mode: 0644]

diff --git a/xsl/xhtml5/chunk.xsl b/xsl/xhtml5/chunk.xsl
new file mode 100644 (file)
index 0000000..e3fc396
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+  xmlns:exsl="http://exslt.org/common"
+  xmlns="http://www.w3.org/1999/xhtml"
+  exclude-result-prefixes="exsl"
+  version="1.0">
+
+<!-- $Id: chunk.xsl,v 1.1 2011-09-16 21:43:59 bobs Exp $ -->
+
+<!-- This is the main driver stylesheet file.  It imports or
+includes all the components that it needs. -->
+
+<!-- Import the module that customizes docbook elements -->
+<!-- Put any customizations of element content in this module. -->
+<xsl:import href="docbook.xsl"/>
+
+<xsl:import href="../xhtml/chunk-common.xsl"/>
+
+<xsl:include href="../xhtml/chunk-code.xsl"/>
+
+<!-- The following module has templates that override the stock
+     xhtml templates for HTML5 output.  
+     It contains match templates with priority="1" attributes,
+     and named templates.  These override any templates that
+     handle chunking behavior -->
+<xsl:include href="html5-chunk-mods.xsl"/>
+
+</xsl:stylesheet>
diff --git a/xsl/xhtml5/chunkfast.xsl b/xsl/xhtml5/chunkfast.xsl
new file mode 100644 (file)
index 0000000..fd1be4d
--- /dev/null
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="cf exsl">
+
+<!-- ********************************************************************
+     $Id: chunkfast.xsl,v 1.1 2011-09-16 21:44:00 bobs Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://docbook.sf.net/release/xsl/current/ for
+     copyright and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<xsl:import href="chunk.xsl"/>
+<xsl:param name="chunk.fast" select="1"/>
+
+<xsl:variable name="chunks" select="exsl:node-set($chunk.hierarchy)//cf:div"/>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="process-chunk-element">
+  <xsl:choose>
+    <xsl:when test="$chunk.fast != 0 and $exsl.node.set.available != 0">
+      <xsl:variable name="genid" select="generate-id()"/>
+
+      <xsl:variable name="div" select="$chunks[@id=$genid or @xml:id=$genid]"/>
+
+      <xsl:variable name="prevdiv" select="($div/preceding-sibling::cf:div|$div/preceding::cf:div|$div/parent::cf:div)[last()]"/>
+      <xsl:variable name="prev" select="key('genid', ($prevdiv/@id|$prevdiv/@xml:id)[1])"/>
+
+      <xsl:variable name="nextdiv" select="($div/following-sibling::cf:div|$div/following::cf:div|$div/cf:div)[1]"/>
+      <xsl:variable name="next" select="key('genid', ($nextdiv/@id|$nextdiv/@xml:id)[1])"/>
+
+      <xsl:choose>
+        <xsl:when test="$onechunk != 0 and parent::*">
+          <xsl:apply-imports/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="process-chunk">
+            <xsl:with-param name="prev" select="$prev"/>
+            <xsl:with-param name="next" select="$next"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:choose>
+        <xsl:when test="$onechunk != 0 and not(parent::*)">
+          <xsl:call-template name="chunk-all-sections"/>
+        </xsl:when>
+        <xsl:when test="$onechunk != 0">
+          <xsl:apply-imports/>
+        </xsl:when>
+        <xsl:when test="$chunk.first.sections = 0">
+          <xsl:call-template name="chunk-first-section-with-parent"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="chunk-all-sections"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xsl/xhtml5/docbook.css.xml b/xsl/xhtml5/docbook.css.xml
new file mode 100644 (file)
index 0000000..9587979
--- /dev/null
@@ -0,0 +1,104 @@
+<?xml version="1.0"?>
+<style>
+
+/********************************/
+/* start of styles in block.xsl */
+
+.formalpara-title {
+  font-weight: bold;
+}
+
+div.blockquote-title {
+  font-weight: bold;
+  margin-top: 1em;
+  margin-bottom: 1em;
+}
+
+span.msgmain-title {
+  font-weight: bold;
+}
+
+span.msgsub-title {
+  font-weight: bold;
+}
+
+span.msgrel-title {
+  font-weight: bold;
+}
+
+div.msglevel, div.msgorig, div.msgaud {
+  margin-top: 1em;
+  margin-bottom: 1em;
+}
+
+span.msglevel-title, span.msgorig-title, span.msgaud-title {
+  font-weight: bold;
+}
+
+div.msgexplan {
+  margin-top: 1em;
+  margin-bottom: 1em;
+}
+
+span.msgexplan-title {
+  font-weight: bold;
+}
+
+/* end of styles in block.xsl */
+/********************************/
+
+/********************************/
+/* start of styles in autotoc.xsl */
+
+
+/* end of styles in autotoc.xsl */
+/********************************/
+
+/********************************/
+/* start of styles in formal.xsl */
+
+div.figure-title {
+  font-weight: bold;
+}
+
+div.example-title {
+  font-weight: bold;
+}
+
+div.equation-title {
+  font-weight: bold;
+}
+
+div.table-title {
+  font-weight: bold;
+}
+
+div.sidebar-title {
+  font-weight: bold;
+}
+
+
+/* end of styles in formal.xsl */
+/********************************/
+
+/********************************/
+/* start of styles in verbatim.xsl */
+
+div.programlisting {
+  white-space: pre;
+  font-family: monospace;
+}
+
+div.screen {
+  white-space: pre;
+  font-family: monospace;
+}
+
+div.synopsis {
+  white-space: pre;
+  font-family: monospace;
+}
+
+/* end of styles in verbatim.xsl */
+/********************************/
+</style>
diff --git a/xsl/xhtml5/docbook.xsl b/xsl/xhtml5/docbook.xsl
new file mode 100644 (file)
index 0000000..421fbb5
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE xsl:stylesheet [
+]>
+<xsl:stylesheet 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+  xmlns:exsl="http://exslt.org/common"
+  xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:stbl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Table"
+  xmlns:xtbl="xalan://com.nwalsh.xalan.Table"
+  xmlns:lxslt="http://xml.apache.org/xslt"
+  xmlns:ptbl="http://nwalsh.com/xslt/ext/xsltproc/python/Table"
+  exclude-result-prefixes="exsl stbl xtbl lxslt ptbl"
+  version="1.0">
+
+<!-- $Id: docbook.xsl,v 1.2 2011-09-18 17:47:28 bobs Exp $ -->
+<xsl:import href="xhtml-docbook.xsl"/>
+<xsl:include href="html5-element-mods.xsl"/>
+
+<xsl:output method="xml" encoding="UTF-8" />
+
+</xsl:stylesheet>
diff --git a/xsl/xhtml5/html5-chunk-mods.xsl b/xsl/xhtml5/html5-chunk-mods.xsl
new file mode 100644 (file)
index 0000000..746fc2b
--- /dev/null
@@ -0,0 +1,497 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+  xmlns:exsl="http://exslt.org/common"
+  xmlns="http://www.w3.org/1999/xhtml"
+  exclude-result-prefixes="exsl"
+  version="1.0">
+
+<!-- $Id: html5-chunk-mods.xsl,v 1.1 2011-09-16 21:44:00 bobs Exp $ -->
+
+<!-- Fix bug: original called "generate.css" -->
+<xsl:template match="*" mode="process.root" priority="1">
+  <xsl:apply-templates select="."/>
+  <xsl:call-template name="generate.css.files"/>
+</xsl:template>
+
+<!-- HTML5: Modify to wrap header in HTML5 <header> element. -->
+<xsl:template name="header.navigation">
+  <xsl:param name="prev" select="/foo"/>
+  <xsl:param name="next" select="/foo"/>
+  <xsl:param name="nav.context"/>
+
+  <xsl:variable name="home" select="/*[1]"/>
+  <xsl:variable name="up" select="parent::*"/>
+
+  <xsl:variable name="row1" select="$navig.showtitles != 0"/>
+  <xsl:variable name="row2" select="count($prev) &gt; 0
+                                    or (count($up) &gt; 0 
+                                        and generate-id($up) != generate-id($home)
+                                        and $navig.showtitles != 0)
+                                    or count($next) &gt; 0"/>
+
+  <xsl:if test="$suppress.navigation = '0' and $suppress.header.navigation = '0'">
+    <xsl:variable name="content">
+      <header>
+        <div class="navheader">
+          <xsl:if test="$row1 or $row2">
+            <table width="100%" summary="Navigation header">
+              <xsl:if test="$row1">
+                <tr>
+                  <th colspan="3" align="center">
+                    <xsl:apply-templates select="." mode="object.title.markup"/>
+                  </th>
+                </tr>
+              </xsl:if>
+    
+              <xsl:if test="$row2">
+                <tr>
+                  <td width="20%" align="{$direction.align.start}">
+                    <xsl:if test="count($prev)>0">
+                      <a accesskey="p">
+                        <xsl:attribute name="href">
+                          <xsl:call-template name="href.target">
+                            <xsl:with-param name="object" select="$prev"/>
+                          </xsl:call-template>
+                        </xsl:attribute>
+                        <xsl:call-template name="navig.content">
+                          <xsl:with-param name="direction" select="'prev'"/>
+                        </xsl:call-template>
+                      </a>
+                    </xsl:if>
+                    <xsl:text>&#160;</xsl:text>
+                  </td>
+                  <th width="60%" align="center">
+                    <xsl:choose>
+                      <xsl:when test="count($up) > 0
+                                      and generate-id($up) != generate-id($home)
+                                      and $navig.showtitles != 0">
+                        <xsl:apply-templates select="$up" mode="object.title.markup"/>
+                      </xsl:when>
+                      <xsl:otherwise>&#160;</xsl:otherwise>
+                    </xsl:choose>
+                  </th>
+                  <td width="20%" align="{$direction.align.end}">
+                    <xsl:text>&#160;</xsl:text>
+                    <xsl:if test="count($next)>0">
+                      <a accesskey="n">
+                        <xsl:attribute name="href">
+                          <xsl:call-template name="href.target">
+                            <xsl:with-param name="object" select="$next"/>
+                          </xsl:call-template>
+                        </xsl:attribute>
+                        <xsl:call-template name="navig.content">
+                          <xsl:with-param name="direction" select="'next'"/>
+                        </xsl:call-template>
+                      </a>
+                    </xsl:if>
+                  </td>
+                </tr>
+              </xsl:if>
+            </table>
+          </xsl:if>
+          <xsl:if test="$header.rule != 0">
+            <hr/>
+          </xsl:if>
+        </div>
+      </header>
+    </xsl:variable>
+
+    <!-- And fix up any style atts -->
+    <xsl:call-template name="convert.styles">
+      <xsl:with-param name="content" select="$content"/>
+    </xsl:call-template>
+
+  </xsl:if>
+</xsl:template>
+
+
+<!-- HTML5: Modify to wrap footer in HTML5 <footer> element. -->
+<xsl:template name="footer.navigation">
+  <xsl:param name="prev" select="/foo"/>
+  <xsl:param name="next" select="/foo"/>
+  <xsl:param name="nav.context"/>
+
+  <xsl:variable name="home" select="/*[1]"/>
+  <xsl:variable name="up" select="parent::*"/>
+
+  <xsl:variable name="row1" select="count($prev) &gt; 0
+                                    or count($up) &gt; 0
+                                    or count($next) &gt; 0"/>
+
+  <xsl:variable name="row2" select="($prev and $navig.showtitles != 0)
+                                    or (generate-id($home) != generate-id(.)
+                                        or $nav.context = 'toc')
+                                    or ($chunk.tocs.and.lots != 0
+                                        and $nav.context != 'toc')
+                                    or ($next and $navig.showtitles != 0)"/>
+
+  <xsl:if test="$suppress.navigation = '0' and $suppress.footer.navigation = '0'">
+    <xsl:variable name="content">
+      <footer>
+        <div class="navfooter">
+          <xsl:if test="$footer.rule != 0">
+            <hr/>
+          </xsl:if>
+    
+          <xsl:if test="$row1 or $row2">
+            <table width="100%" summary="Navigation footer">
+              <xsl:if test="$row1">
+                <tr>
+                  <td width="40%" align="{$direction.align.start}">
+                    <xsl:if test="count($prev)>0">
+                      <a accesskey="p">
+                        <xsl:attribute name="href">
+                          <xsl:call-template name="href.target">
+                            <xsl:with-param name="object" select="$prev"/>
+                          </xsl:call-template>
+                        </xsl:attribute>
+                        <xsl:call-template name="navig.content">
+                          <xsl:with-param name="direction" select="'prev'"/>
+                        </xsl:call-template>
+                      </a>
+                    </xsl:if>
+                    <xsl:text>&#160;</xsl:text>
+                  </td>
+                  <td width="20%" align="center">
+                    <xsl:choose>
+                      <xsl:when test="count($up)&gt;0
+                                      and generate-id($up) != generate-id($home)">
+                        <a accesskey="u">
+                          <xsl:attribute name="href">
+                            <xsl:call-template name="href.target">
+                              <xsl:with-param name="object" select="$up"/>
+                            </xsl:call-template>
+                          </xsl:attribute>
+                          <xsl:call-template name="navig.content">
+                            <xsl:with-param name="direction" select="'up'"/>
+                          </xsl:call-template>
+                        </a>
+                      </xsl:when>
+                      <xsl:otherwise>&#160;</xsl:otherwise>
+                    </xsl:choose>
+                  </td>
+                  <td width="40%" align="{$direction.align.end}">
+                    <xsl:text>&#160;</xsl:text>
+                    <xsl:if test="count($next)>0">
+                      <a accesskey="n">
+                        <xsl:attribute name="href">
+                          <xsl:call-template name="href.target">
+                            <xsl:with-param name="object" select="$next"/>
+                          </xsl:call-template>
+                        </xsl:attribute>
+                        <xsl:call-template name="navig.content">
+                          <xsl:with-param name="direction" select="'next'"/>
+                        </xsl:call-template>
+                      </a>
+                    </xsl:if>
+                  </td>
+                </tr>
+              </xsl:if>
+    
+              <xsl:if test="$row2">
+                <tr>
+                  <td width="40%" align="{$direction.align.start}" valign="top">
+                    <xsl:if test="$navig.showtitles != 0">
+                      <xsl:apply-templates select="$prev" mode="object.title.markup"/>
+                    </xsl:if>
+                    <xsl:text>&#160;</xsl:text>
+                  </td>
+                  <td width="20%" align="center">
+                    <xsl:choose>
+                      <xsl:when test="$home != . or $nav.context = 'toc'">
+                        <a accesskey="h">
+                          <xsl:attribute name="href">
+                            <xsl:call-template name="href.target">
+                              <xsl:with-param name="object" select="$home"/>
+                            </xsl:call-template>
+                          </xsl:attribute>
+                          <xsl:call-template name="navig.content">
+                            <xsl:with-param name="direction" select="'home'"/>
+                          </xsl:call-template>
+                        </a>
+                        <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
+                          <xsl:text>&#160;|&#160;</xsl:text>
+                        </xsl:if>
+                      </xsl:when>
+                      <xsl:otherwise>&#160;</xsl:otherwise>
+                    </xsl:choose>
+    
+                    <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
+                      <a accesskey="t">
+                        <xsl:attribute name="href">
+                          <xsl:apply-templates select="/*[1]"
+                                               mode="recursive-chunk-filename">
+                            <xsl:with-param name="recursive" select="true()"/>
+                          </xsl:apply-templates>
+                          <xsl:text>-toc</xsl:text>
+                          <xsl:value-of select="$html.ext"/>
+                        </xsl:attribute>
+                        <xsl:call-template name="gentext">
+                          <xsl:with-param name="key" select="'nav-toc'"/>
+                        </xsl:call-template>
+                      </a>
+                    </xsl:if>
+                  </td>
+                  <td width="40%" align="{$direction.align.end}" valign="top">
+                    <xsl:text>&#160;</xsl:text>
+                    <xsl:if test="$navig.showtitles != 0">
+                      <xsl:apply-templates select="$next" mode="object.title.markup"/>
+                    </xsl:if>
+                  </td>
+                </tr>
+              </xsl:if>
+            </table>
+          </xsl:if>
+        </div>
+      </footer>
+    </xsl:variable>
+
+    <!-- And fix up any style atts -->
+    <xsl:call-template name="convert.styles">
+      <xsl:with-param name="content" select="$content"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+<!-- HTML5: fix styles in footnote output -->
+<xsl:template name="process.footnotes">
+  <xsl:variable name="footnotes" select=".//footnote"/>
+  <xsl:variable name="fcount">
+    <xsl:call-template name="count.footnotes.in.this.chunk">
+      <xsl:with-param name="node" select="."/>
+      <xsl:with-param name="footnotes" select="$footnotes"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+<!--
+  <xsl:message>
+    <xsl:value-of select="name(.)"/>
+    <xsl:text> fcount: </xsl:text>
+    <xsl:value-of select="$fcount"/>
+  </xsl:message>
+-->
+
+  <!-- Only bother to do this if there's at least one non-table footnote -->
+  <xsl:if test="$fcount &gt; 0">
+    <div class="footnotes">
+      <xsl:call-template name="footnotes.attributes"/>
+      <br/>
+      <hr style="width: 100; align: {$direction.align.start};"/>
+      <xsl:call-template name="process.footnotes.in.this.chunk">
+        <xsl:with-param name="node" select="."/>
+        <xsl:with-param name="footnotes" select="$footnotes"/>
+      </xsl:call-template>
+    </div>
+  </xsl:if>
+
+  <!-- FIXME: When chunking, only the annotations actually used
+              in this chunk should be referenced. I don't think it
+              does any harm to reference them all, but it adds
+              unnecessary bloat to each chunk. -->
+  <xsl:if test="$annotation.support != 0 and //annotation">
+    <div class="annotation-list">
+      <div class="annotation-nocss">
+        <p>The following annotations are from this essay. You are seeing
+        them here because your browser doesn’t support the user-interface
+        techniques used to make them appear as â€˜popups’ on modern browsers.</p>
+      </div>
+
+      <xsl:apply-templates select="//annotation"
+                           mode="annotation-popup"/>
+    </div>
+  </xsl:if>
+</xsl:template>
+
+<!-- HTML5: link rel="home" is not permitted -->
+<xsl:template name="html.head">
+  <xsl:param name="prev" select="/foo"/>
+  <xsl:param name="next" select="/foo"/>
+  <xsl:variable name="this" select="."/>
+  <xsl:variable name="home" select="/*[1]"/>
+  <xsl:variable name="up" select="parent::*"/>
+
+  <head>
+    <xsl:call-template name="system.head.content"/>
+    <xsl:call-template name="head.content"/>
+
+    <!--
+    <xsl:if test="$home">
+      <link rel="home">
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$home"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:attribute name="title">
+          <xsl:apply-templates select="$home"
+                               mode="object.title.markup.textonly"/>
+        </xsl:attribute>
+      </link>
+    </xsl:if>
+    -->
+
+    <xsl:if test="$up">
+      <link rel="up">
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$up"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:attribute name="title">
+          <xsl:apply-templates select="$up" mode="object.title.markup.textonly"/>
+        </xsl:attribute>
+      </link>
+    </xsl:if>
+
+    <xsl:if test="$prev">
+      <link rel="prev">
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$prev"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:attribute name="title">
+          <xsl:apply-templates select="$prev" mode="object.title.markup.textonly"/>
+        </xsl:attribute>
+      </link>
+    </xsl:if>
+
+    <xsl:if test="$next">
+      <link rel="next">
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$next"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:attribute name="title">
+          <xsl:apply-templates select="$next" mode="object.title.markup.textonly"/>
+        </xsl:attribute>
+      </link>
+    </xsl:if>
+
+    <xsl:if test="$html.extra.head.links != 0">
+      <xsl:for-each select="//part
+                            |//reference
+                            |//preface
+                            |//chapter
+                            |//article
+                            |//refentry
+                            |//appendix[not(parent::article)]|appendix
+                            |//glossary[not(parent::article)]|glossary
+                            |//index[not(parent::article)]|index">
+        <link rel="{local-name(.)}">
+          <xsl:attribute name="href">
+            <xsl:call-template name="href.target">
+              <xsl:with-param name="context" select="$this"/>
+              <xsl:with-param name="object" select="."/>
+            </xsl:call-template>
+          </xsl:attribute>
+          <xsl:attribute name="title">
+            <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
+          </xsl:attribute>
+        </link>
+      </xsl:for-each>
+
+      <xsl:for-each select="section|sect1|refsection|refsect1">
+        <link>
+          <xsl:attribute name="rel">
+            <xsl:choose>
+              <xsl:when test="local-name($this) = 'section'
+                              or local-name($this) = 'refsection'">
+                <xsl:value-of select="'subsection'"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:value-of select="'section'"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:attribute>
+          <xsl:attribute name="href">
+            <xsl:call-template name="href.target">
+              <xsl:with-param name="context" select="$this"/>
+              <xsl:with-param name="object" select="."/>
+            </xsl:call-template>
+          </xsl:attribute>
+          <xsl:attribute name="title">
+            <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
+          </xsl:attribute>
+        </link>
+      </xsl:for-each>
+
+      <xsl:for-each select="sect2|sect3|sect4|sect5|refsect2|refsect3">
+        <link rel="subsection">
+          <xsl:attribute name="href">
+            <xsl:call-template name="href.target">
+              <xsl:with-param name="context" select="$this"/>
+              <xsl:with-param name="object" select="."/>
+            </xsl:call-template>
+          </xsl:attribute>
+          <xsl:attribute name="title">
+            <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
+          </xsl:attribute>
+        </link>
+      </xsl:for-each>
+    </xsl:if>
+
+    <!-- * if we have a legalnotice and user wants it output as a -->
+    <!-- * separate page and $html.head.legalnotice.link.types is -->
+    <!-- * non-empty, we generate a link or links for each value in -->
+    <!-- * $html.head.legalnotice.link.types -->
+    <xsl:if test="//legalnotice
+                  and not($generate.legalnotice.link = 0)
+                  and not($html.head.legalnotice.link.types = '')">
+      <xsl:call-template name="make.legalnotice.head.links"/>
+    </xsl:if>
+
+    <xsl:call-template name="user.head.content"/>
+  </head>
+</xsl:template>
+
+<!-- Add call to new root.attributes template for <html> attribute -->
+<xsl:template name="chunk-element-content">
+  <xsl:param name="prev"/>
+  <xsl:param name="next"/>
+  <xsl:param name="nav.context"/>
+  <xsl:param name="content">
+    <xsl:apply-imports/>
+  </xsl:param>
+
+  <xsl:call-template name="user.preroot"/>
+
+  <html>
+    <xsl:call-template name="root.attributes"/>
+    <xsl:call-template name="html.head">
+      <xsl:with-param name="prev" select="$prev"/>
+      <xsl:with-param name="next" select="$next"/>
+    </xsl:call-template>
+
+    <body>
+      <xsl:call-template name="body.attributes"/>
+      <xsl:call-template name="user.header.navigation"/>
+
+      <xsl:call-template name="header.navigation">
+        <xsl:with-param name="prev" select="$prev"/>
+        <xsl:with-param name="next" select="$next"/>
+        <xsl:with-param name="nav.context" select="$nav.context"/>
+      </xsl:call-template>
+
+      <xsl:call-template name="user.header.content"/>
+
+      <xsl:copy-of select="$content"/>
+
+      <xsl:call-template name="user.footer.content"/>
+
+      <xsl:call-template name="footer.navigation">
+        <xsl:with-param name="prev" select="$prev"/>
+        <xsl:with-param name="next" select="$next"/>
+        <xsl:with-param name="nav.context" select="$nav.context"/>
+      </xsl:call-template>
+
+      <xsl:call-template name="user.footer.navigation"/>
+    </body>
+  </html>
+  <xsl:value-of select="$chunk.append"/>
+</xsl:template>
+
+
+</xsl:stylesheet>
diff --git a/xsl/xhtml5/html5-element-mods.xsl b/xsl/xhtml5/html5-element-mods.xsl
new file mode 100644 (file)
index 0000000..7cad525
--- /dev/null
@@ -0,0 +1,1067 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE xsl:stylesheet [
+<!ENTITY % common.entities SYSTEM "../common/entities.ent">
+%common.entities;
+]>
+<xsl:stylesheet 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+  xmlns:exsl="http://exslt.org/common"
+  xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:stbl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Table"
+  xmlns:xtbl="xalan://com.nwalsh.xalan.Table"
+  xmlns:lxslt="http://xml.apache.org/xslt"
+  xmlns:ptbl="http://nwalsh.com/xslt/ext/xsltproc/python/Table"
+  exclude-result-prefixes="exsl stbl xtbl lxslt ptbl"
+  version="1.0">
+
+<!-- $Id: html5-element-mods.xsl,v 1.2 2011-09-18 17:47:28 bobs Exp $ -->
+
+<!--==============================================================-->
+<!--  DocBook XSL Parameter settings                              -->
+<!--==============================================================-->
+<!-- Set these to blank so can output special HTML5 empty DOCTYPE -->
+<xsl:param name="chunker.output.doctype-system" select="''"/>
+<xsl:param name="chunker.output.doctype-public" select="''"/>
+
+<xsl:param name="table.borders.with.css" select="1"/>
+<xsl:param name="html.ext">.xhtml</xsl:param>
+<xsl:param name="toc.list.type">ul</xsl:param>
+<xsl:param name="css.decoration" select="1"/>
+<xsl:param name="make.clean.html" select="1"/>
+<xsl:param name="generate.id.attributes" select="1"/>
+
+<!--==============================================================-->
+<!--  Customized templates                                        -->
+<!--==============================================================-->
+
+<!-- HTML5: Replace HTML acronum with abbr for HTML 5 -->
+<xsl:template match="acronym">
+  <xsl:call-template name="inline.charseq">
+    <xsl:with-param name="wrapper-name">abbr</xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+
+<!-- HTML5: replace border="0" with border="" -->
+<!-- HTML5: No @summary allowed -->
+<!-- HTML5: replace many table atts with CSS styles -->
+<xsl:template match="tgroup" name="tgroup">
+  <xsl:if test="not(@cols) or @cols = '' or string(number(@cols)) = 'NaN'">
+    <xsl:message terminate="yes">
+      <xsl:text>Error: CALS tables must specify the number of columns.</xsl:text>
+    </xsl:message>
+  </xsl:if>
+
+  <xsl:variable name="summary">
+    <xsl:call-template name="pi.dbhtml_table-summary"/>
+  </xsl:variable>
+
+  <xsl:variable name="cellspacing">
+    <xsl:call-template name="pi.dbhtml_cellspacing"/>
+  </xsl:variable>
+
+  <xsl:variable name="cellpadding">
+    <xsl:call-template name="pi.dbhtml_cellpadding"/>
+  </xsl:variable>
+
+  <!-- First generate colgroup with attributes -->
+  <xsl:variable name="colgroup.with.attributes">
+    <colgroup>
+      <xsl:call-template name="generate.colgroup">
+        <xsl:with-param name="cols" select="@cols"/>
+      </xsl:call-template>
+    </colgroup>
+  </xsl:variable>
+
+  <!-- then modify colgroup attributes with extension -->
+  <xsl:variable name="colgroup.with.extension">
+    <xsl:choose>
+      <xsl:when test="$use.extensions != 0
+                      and $tablecolumns.extension != 0">
+        <xsl:choose>
+          <xsl:when test="function-available('stbl:adjustColumnWidths')">
+            <xsl:copy-of select="stbl:adjustColumnWidths($colgroup.with.attributes)"/>
+          </xsl:when>
+          <xsl:when test="function-available('xtbl:adjustColumnWidths')">
+            <xsl:copy-of select="xtbl:adjustColumnWidths($colgroup.with.attributes)"/>
+          </xsl:when>
+          <xsl:when test="function-available('ptbl:adjustColumnWidths')">
+            <xsl:copy-of select="ptbl:adjustColumnWidths($colgroup.with.attributes)"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:message terminate="yes">
+              <xsl:text>No adjustColumnWidths function available.</xsl:text>
+            </xsl:message>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy-of select="$colgroup.with.attributes"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <!-- Now convert to @style -->
+  <xsl:variable name="colgroup">
+    <xsl:call-template name="colgroup.with.style">
+      <xsl:with-param name="colgroup" select="colgroup.with.extension"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="explicit.table.width">
+    <xsl:call-template name="pi.dbhtml_table-width">
+      <xsl:with-param name="node" select=".."/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="table.width.candidate">
+    <xsl:choose>
+      <xsl:when test="$explicit.table.width != ''">
+        <xsl:value-of select="$explicit.table.width"/>
+      </xsl:when>
+      <xsl:when test="$default.table.width = ''">
+        <xsl:text>100%</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$default.table.width"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+
+  <xsl:variable name="table.width">
+    <xsl:if test="$default.table.width != ''
+                  or $explicit.table.width != ''">
+      <xsl:choose>
+        <xsl:when test="contains($table.width.candidate, '%')">
+          <xsl:value-of select="$table.width.candidate"/>
+        </xsl:when>
+        <xsl:when test="$use.extensions != 0
+                        and $tablecolumns.extension != 0">
+          <xsl:choose>
+            <xsl:when test="function-available('stbl:convertLength')">
+              <xsl:value-of select="stbl:convertLength($table.width.candidate)"/>
+            </xsl:when>
+            <xsl:when test="function-available('xtbl:convertLength')">
+              <xsl:value-of select="xtbl:convertLength($table.width.candidate)"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:message terminate="yes">
+                <xsl:text>No convertLength function available.</xsl:text>
+              </xsl:message>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$table.width.candidate"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+  </xsl:variable>
+
+  <!-- assemble a table @style -->
+  <xsl:variable name="table.style">
+
+    <xsl:if test="$cellspacing != '' or $html.cellspacing != ''">
+      <xsl:text>cellspacing: </xsl:text>
+      <xsl:choose>
+        <xsl:when test="$cellspacing != ''">
+          <xsl:value-of select="$cellspacing"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$html.cellspacing"/>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:text>; </xsl:text>
+    </xsl:if>
+
+    <xsl:if test="$cellpadding != '' or $html.cellpadding != ''">
+      <xsl:text>cellpadding: </xsl:text>
+      <xsl:choose>
+        <xsl:when test="$cellpadding != ''">
+          <xsl:value-of select="$cellpadding"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$html.cellpadding"/>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:text>; </xsl:text>
+    </xsl:if>
+
+    <xsl:choose>
+      <xsl:when test="string-length($table.width) != 0">
+        <xsl:text>width: </xsl:text>
+        <xsl:value-of select="$table.width"/>
+        <xsl:text>; </xsl:text>
+      </xsl:when>
+      <xsl:when test="../@pgwide=1 or local-name(.) = 'entrytbl'">
+        <xsl:text>width: 100%; </xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:choose>
+      <xsl:when test="../@frame='all' or (not(../@frame) and $default.table.frame='all')">
+        <xsl:text>border-collapse: collapse; </xsl:text>
+        <xsl:call-template name="border">
+          <xsl:with-param name="side" select="'top'"/>
+          <xsl:with-param name="style" select="$table.frame.border.style"/>
+          <xsl:with-param name="color" select="$table.frame.border.color"/>
+          <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
+        </xsl:call-template>
+        <xsl:call-template name="border">
+          <xsl:with-param name="side" select="'bottom'"/>
+          <xsl:with-param name="style" select="$table.frame.border.style"/>
+          <xsl:with-param name="color" select="$table.frame.border.color"/>
+          <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
+        </xsl:call-template>
+        <xsl:call-template name="border">
+          <xsl:with-param name="side" select="'left'"/>
+          <xsl:with-param name="style" select="$table.frame.border.style"/>
+          <xsl:with-param name="color" select="$table.frame.border.color"/>
+          <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
+        </xsl:call-template>
+        <xsl:call-template name="border">
+          <xsl:with-param name="side" select="'right'"/>
+          <xsl:with-param name="style" select="$table.frame.border.style"/>
+          <xsl:with-param name="color" select="$table.frame.border.color"/>
+          <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="../@frame='topbot' or (not(../@frame) and $default.table.frame='topbot')">
+        <xsl:text>border-collapse: collapse;</xsl:text>
+        <xsl:call-template name="border">
+          <xsl:with-param name="side" select="'top'"/>
+          <xsl:with-param name="style" select="$table.frame.border.style"/>
+          <xsl:with-param name="color" select="$table.frame.border.color"/>
+          <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
+        </xsl:call-template>
+        <xsl:call-template name="border">
+          <xsl:with-param name="side" select="'bottom'"/>
+          <xsl:with-param name="style" select="$table.frame.border.style"/>
+          <xsl:with-param name="color" select="$table.frame.border.color"/>
+          <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="../@frame='top' or (not(../@frame) and $default.table.frame='top')">
+        <xsl:text>border-collapse: collapse;</xsl:text>
+        <xsl:call-template name="border">
+          <xsl:with-param name="side" select="'top'"/>
+          <xsl:with-param name="style" select="$table.frame.border.style"/>
+          <xsl:with-param name="color" select="$table.frame.border.color"/>
+          <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="../@frame='bottom' or (not(../@frame) and $default.table.frame='bottom')">
+        <xsl:text>border-collapse: collapse;</xsl:text>
+        <xsl:call-template name="border">
+          <xsl:with-param name="side" select="'bottom'"/>
+          <xsl:with-param name="style" select="$table.frame.border.style"/>
+          <xsl:with-param name="color" select="$table.frame.border.color"/>
+          <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="../@frame='sides' or (not(../@frame) and $default.table.frame='sides')">
+        <xsl:text>border-collapse: collapse;</xsl:text>
+        <xsl:call-template name="border">
+          <xsl:with-param name="side" select="'left'"/>
+          <xsl:with-param name="style" select="$table.frame.border.style"/>
+          <xsl:with-param name="color" select="$table.frame.border.color"/>
+          <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
+        </xsl:call-template>
+        <xsl:call-template name="border">
+          <xsl:with-param name="side" select="'right'"/>
+          <xsl:with-param name="style" select="$table.frame.border.style"/>
+          <xsl:with-param name="color" select="$table.frame.border.color"/>
+          <xsl:with-param name="thickness" select="$table.frame.border.thickness"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="../@frame='none'">
+        <xsl:text>border: none;</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>border-collapse: collapse;</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <table>
+    <!-- HTML5: no table summary allowed -->
+    <xsl:if test="string-length($table.style) != 0">
+      <xsl:attribute name="style">
+        <xsl:value-of select="$table.style"/>
+      </xsl:attribute>
+    </xsl:if>
+
+
+    <xsl:copy-of select="$colgroup"/>
+
+    <xsl:apply-templates select="thead"/>
+    <xsl:apply-templates select="tfoot"/>
+    <xsl:apply-templates select="tbody"/>
+
+    <xsl:if test=".//footnote|../title//footnote">
+      <tbody class="footnotes">
+        <tr>
+          <td colspan="{@cols}">
+            <xsl:apply-templates select=".//footnote|../title//footnote" mode="table.footnote.mode"/>
+          </td>
+        </tr>
+      </tbody>
+    </xsl:if>
+  </table>
+</xsl:template>
+
+<!-- HTML5: convert col attributes to col CSS styles -->
+<xsl:template name="colgroup.with.style">
+  <xsl:param name="colgroup"/>
+
+  <xsl:variable name="colgroup.nodeset" select="exsl:node-set($colgroup)"/>
+  <xsl:apply-templates select="$colgroup.nodeset" mode="convert.to.style"/>
+</xsl:template>
+
+<xsl:template match="colgroup" mode="convert.to.style">
+  <xsl:copy>
+    <xsl:copy-of select="@*"/>
+    <xsl:apply-templates mode="convert.to.style"/>
+  </xsl:copy>
+</xsl:template>
+
+<!-- HTML5: converts obsolete HTML attributes to CSS styles -->
+<xsl:template match="*" mode="convert.to.style">
+
+  <xsl:variable name="style.from.atts">
+    <xsl:for-each select="@*">
+
+      <xsl:choose>
+        <xsl:when test="local-name() = 'width'">
+          <xsl:text>width: </xsl:text>
+          <xsl:value-of select="."/>
+          <xsl:text>; </xsl:text>
+        </xsl:when>
+
+        <xsl:when test="local-name() = 'align'">
+          <xsl:text>align: </xsl:text>
+          <xsl:value-of select="."/>
+          <xsl:text>; </xsl:text>
+        </xsl:when>
+
+        <xsl:when test="local-name() = 'valign'">
+          <xsl:text>vertical-align: </xsl:text>
+          <xsl:value-of select="."/>
+          <xsl:text>; </xsl:text>
+        </xsl:when>
+
+        <xsl:when test="local-name() = 'border'">
+          <xsl:text>border: </xsl:text>
+          <xsl:value-of select="."/>
+          <xsl:text>; </xsl:text>
+        </xsl:when>
+
+        <xsl:when test="local-name() = 'cellspacing'">
+          <xsl:text>border-spacing: </xsl:text>
+          <xsl:value-of select="."/>
+          <xsl:text>; </xsl:text>
+        </xsl:when>
+
+        <xsl:when test="local-name() = 'cellpadding'">
+          <xsl:text>padding: </xsl:text>
+          <xsl:value-of select="."/>
+          <xsl:text>; </xsl:text>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:for-each>
+  </xsl:variable>
+
+  <!-- merge existing styles with these new styles -->
+  <xsl:variable name="style">
+    <xsl:value-of select="concat($style.from.atts, @style)"/>
+  </xsl:variable>
+
+  <!-- HTML5: <th> does not support block elements, use <td> -->
+  <xsl:variable name="element.name">
+    <xsl:choose>
+      <xsl:when test="local-name(.) = 'th'">td</xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="local-name(.)"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:element name="{$element.name}">
+    <xsl:if test="string-length($style) != 0">
+      <xsl:attribute name="style">
+        <xsl:value-of select="$style"/>
+      </xsl:attribute>
+    </xsl:if>
+    <!-- Also skip disallowed summary attributes -->
+    <xsl:copy-of select="@*[local-name(.) != 'width' and
+                            local-name(.) != 'summary' and
+                            local-name(.) != 'border' and
+                            local-name(.) != 'cellspacing' and
+                            local-name(.) != 'cellpadding' and
+                            local-name(.) != 'style' and
+                            local-name(.) != 'align' and
+                            local-name(.) != 'valign']"/>
+    <xsl:apply-templates mode="convert.to.style"/>
+  </xsl:element>
+</xsl:template>
+
+<!-- HTML5: convert some attributes to CSS style attribute -->
+<xsl:template match="entry|entrytbl">
+  <xsl:param name="col">
+    <xsl:choose>
+      <xsl:when test="@revisionflag">
+        <xsl:number from="row"/>
+      </xsl:when>
+      <xsl:otherwise>1</xsl:otherwise>
+    </xsl:choose>
+  </xsl:param>
+
+  <xsl:param name="spans"/>
+
+  
+  <!-- Process with stock template -->
+  <xsl:variable name="cell">
+    <xsl:call-template name="entry">
+      <xsl:with-param name="col" select="$col"/>
+      <xsl:with-param name="spans" select="$spans"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="cell.nodes" select="exsl:node-set($cell)"/>
+
+  <xsl:apply-templates select="$cell.nodes" mode="convert.to.style"/>
+
+</xsl:template>
+
+<xsl:template match="mediaobject|inlinemediaobject">
+  <xsl:call-template name="convert.styles"/>
+</xsl:template>
+
+<xsl:template match="calloutlist|revhistory|footnote|figure|co">
+  <xsl:call-template name="convert.styles"/>
+</xsl:template>
+
+<xsl:template match="revhistory" mode="titlepage.mode">
+  <xsl:call-template name="convert.styles"/>
+</xsl:template>
+
+<xsl:template match="simplelist">
+  <xsl:call-template name="convert.styles"/>
+</xsl:template>
+
+<xsl:template name="convert.styles">
+  <xsl:param name="content">
+   <xsl:apply-imports/>
+  </xsl:param>
+  <xsl:variable name="nodes" select="exsl:node-set($content)"/>
+
+  <xsl:apply-templates mode="convert.to.style" select="$nodes"/>
+</xsl:template>
+
+
+<!-- HTML5: needs special doctype -->
+<xsl:template name="user.preroot">
+  <xsl:text disable-output-escaping="yes">&lt;!DOCTYPE html&gt;</xsl:text>
+</xsl:template>
+
+<!-- HTML5: @type not permitted on lists -->
+<xsl:template match="itemizedlist">
+  <div>
+    <xsl:call-template name="common.html.attributes"/>
+    <xsl:call-template name="anchor"/>
+    <xsl:if test="title">
+      <xsl:call-template name="formal.object.heading"/>
+    </xsl:if>
+
+    <xsl:variable name="style.value">
+      <xsl:variable name="type">
+        <xsl:call-template name="list.itemsymbol"/>
+      </xsl:variable>
+
+      <xsl:text>list-style-type: </xsl:text>
+      <xsl:value-of select="$type"/>
+      <xsl:text>; </xsl:text>
+
+    </xsl:variable>
+
+    <!-- Preserve order of PIs and comments -->
+    <xsl:apply-templates 
+        select="*[not(self::listitem
+                  or self::title
+                  or self::titleabbrev)]
+                |comment()[not(preceding-sibling::listitem)]
+                |processing-instruction()[not(preceding-sibling::listitem)]"/>
+
+    <ul>
+      <xsl:call-template name="generate.class.attribute"/>
+
+      <xsl:apply-templates 
+            select="listitem
+                    |comment()[preceding-sibling::listitem]
+                    |processing-instruction()[preceding-sibling::listitem]"/>
+    </ul>
+  </div>
+</xsl:template>
+
+<xsl:template name="process.footnotes">
+  <xsl:variable name="footnotes" select=".//footnote"/>
+  <xsl:variable name="table.footnotes"
+                select=".//table//footnote | .//informaltable//footnote"/>
+
+  <!-- Only bother to do this if there's at least one non-table footnote -->
+  <xsl:if test="count($footnotes)>count($table.footnotes)">
+    <div class="footnotes">
+      <xsl:call-template name="footnotes.attributes"/>
+      <br/>
+      <hr style="width: 100; align: {$direction.align.start};"/>
+      <xsl:apply-templates select="$footnotes" mode="process.footnote.mode"/>
+    </div>
+  </xsl:if>
+
+  <xsl:if test="$annotation.support != 0 and //annotation">
+    <div class="annotation-list">
+      <div class="annotation-nocss">
+       <p>The following annotations are from this essay. You are seeing
+       them here because your browser doesn’t support the user-interface
+       techniques used to make them appear as â€˜popups’ on modern browsers.</p>
+      </div>
+
+      <xsl:apply-templates select="//annotation"
+                          mode="annotation-popup"/>
+    </div>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="footnotes.attributes">
+</xsl:template>
+
+<!-- HTML5: ouput section element for chapter -->
+<xsl:template match="chapter">
+  <xsl:call-template name="id.warning"/>
+
+  <section>
+    <xsl:call-template name="common.html.attributes">
+      <xsl:with-param name="inherit" select="1"/>
+    </xsl:call-template>
+    <xsl:if test="$generate.id.attributes != 0">
+      <xsl:attribute name="id">
+        <xsl:call-template name="object.id"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:call-template name="component.separator"/>
+    <xsl:call-template name="chapter.titlepage"/>
+
+    <xsl:variable name="toc.params">
+      <xsl:call-template name="find.path.params">
+        <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:if test="contains($toc.params, 'toc')">
+      <xsl:call-template name="component.toc">
+        <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
+      </xsl:call-template>
+      <xsl:call-template name="component.toc.separator"/>
+    </xsl:if>
+    <xsl:apply-templates/>
+    <xsl:call-template name="process.footnotes"/>
+  </section>
+</xsl:template>
+
+<!-- HTML5: ouput section element for appendix -->
+<xsl:template match="appendix">
+
+  <xsl:variable name="ischunk">
+    <xsl:call-template name="chunk"/>
+  </xsl:variable>
+
+  <xsl:call-template name="id.warning"/>
+
+  <section>
+    <xsl:call-template name="common.html.attributes">
+      <xsl:with-param name="inherit" select="1"/>
+    </xsl:call-template>
+    <xsl:if test="$generate.id.attributes != 0">
+      <xsl:attribute name="id">
+        <xsl:call-template name="object.id"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:choose>
+      <xsl:when test="parent::article and $ischunk = 0">
+        <xsl:call-template name="section.heading">
+          <xsl:with-param name="level" select="1"/>
+          <xsl:with-param name="title">
+            <xsl:apply-templates select="." mode="object.title.markup"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="component.separator"/>
+        <xsl:call-template name="appendix.titlepage"/>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:variable name="toc.params">
+      <xsl:call-template name="find.path.params">
+        <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:if test="contains($toc.params, 'toc')">
+      <xsl:call-template name="component.toc">
+        <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
+      </xsl:call-template>
+      <xsl:call-template name="component.toc.separator"/>
+    </xsl:if>
+
+    <xsl:apply-templates/>
+
+    <xsl:if test="not(parent::article) or $ischunk != 0">
+      <xsl:call-template name="process.footnotes"/>
+    </xsl:if>
+  </section>
+</xsl:template>
+
+<!-- HTML5: ouput section element for section -->
+<xsl:template match="section">
+  <xsl:variable name="depth" select="count(ancestor::section)+1"/>
+
+  <xsl:call-template name="id.warning"/>
+
+  <section>
+    <xsl:call-template name="common.html.attributes">
+      <xsl:with-param name="inherit" select="1"/>
+    </xsl:call-template>
+    <xsl:call-template name="section.titlepage"/>
+
+    <xsl:variable name="toc.params">
+      <xsl:call-template name="find.path.params">
+        <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:if test="contains($toc.params, 'toc')                   and $depth &lt;= $generate.section.toc.level">
+      <xsl:call-template name="section.toc">
+        <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
+      </xsl:call-template>
+      <xsl:call-template name="section.toc.separator"/>
+    </xsl:if>
+    <xsl:apply-templates/>
+    <xsl:call-template name="process.chunk.footnotes"/>
+  </section>
+</xsl:template>
+
+<!-- HTML5: link rel="home" is not permitted -->
+<!-- Add support for attributes on <html> element  -->
+<xsl:template match="*" mode="process.root">
+  <xsl:variable name="doc" select="self::*"/>
+
+  <xsl:call-template name="user.preroot"/>
+  <xsl:call-template name="root.messages"/>
+
+  <html>
+    <xsl:call-template name="root.attributes"/>
+    <head>
+      <xsl:call-template name="system.head.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+      <xsl:call-template name="head.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+      <xsl:call-template name="user.head.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+    </head>
+    <body>
+      <xsl:call-template name="body.attributes"/>
+      <xsl:call-template name="user.header.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+      <xsl:apply-templates select="."/>
+      <xsl:call-template name="user.footer.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+    </body>
+  </html>
+  <xsl:value-of select="$html.append"/>
+  
+  <!-- Generate any css files only once, not once per chunk -->
+  <xsl:call-template name="generate.css.files"/>
+</xsl:template>
+
+<xsl:template name="root.attributes">
+</xsl:template>
+
+<!-- HTML5: Put glossary in <section> element -->
+<xsl:template match="glossary">
+  
+  <xsl:variable name="language">
+    <xsl:call-template name="l10n.language"/>
+  </xsl:variable>
+  
+  <xsl:variable name="lowercase">
+    <xsl:call-template name="gentext">
+      <xsl:with-param name="key">normalize.sort.input</xsl:with-param>
+    </xsl:call-template>
+  </xsl:variable>
+  
+  <xsl:variable name="uppercase">
+    <xsl:call-template name="gentext">
+      <xsl:with-param name="key">normalize.sort.output</xsl:with-param>
+    </xsl:call-template>
+  </xsl:variable>
+  
+  <xsl:call-template name="id.warning"/>
+
+  <section>
+    <xsl:apply-templates select="." mode="common.html.attributes"/>
+    <xsl:if test="$generate.id.attributes != 0">
+      <xsl:attribute name="id">
+        <xsl:call-template name="object.id"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:call-template name="glossary.titlepage"/>
+
+    <xsl:choose>
+      <xsl:when test="glossdiv">
+        <xsl:apply-templates select="(glossdiv[1]/preceding-sibling::*)"/>
+      </xsl:when>
+      <xsl:when test="glossentry">
+        <xsl:apply-templates select="(glossentry[1]/preceding-sibling::*)"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates/>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:choose>
+      <xsl:when test="glossdiv">
+        <xsl:apply-templates select="glossdiv"/>
+      </xsl:when>
+      <xsl:when test="glossentry">
+        <dl>
+          <xsl:choose>
+            <xsl:when test="$glossary.sort != 0">
+              <xsl:apply-templates select="glossentry">
+                               <xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), 'Aa&#192;&#224;&#193;&#225;&#194;&#226;&#195;&#227;&#196;&#228;&#197;&#229;&#256;&#257;&#258;&#259;&#260;&#261;&#461;&#462;&#478;&#479;&#480;&#481;&#506;&#507;&#512;&#513;&#514;&#515;&#550;&#551;&#7680;&#7681;&#7834;&#7840;&#7841;&#7842;&#7843;&#7844;&#7845;&#7846;&#7847;&#7848;&#7849;&#7850;&#7851;&#7852;&#7853;&#7854;&#7855;&#7856;&#7857;&#7858;&#7859;&#7860;&#7861;&#7862;&#7863;Bb&#384;&#385;&#595;&#386;&#387;&#7682;&#7683;&#7684;&#7685;&#7686;&#7687;Cc&#199;&#231;&#262;&#263;&#264;&#265;&#266;&#267;&#268;&#269;&#391;&#392;&#597;&#7688;&#7689;Dd&#270;&#271;&#272;&#273;&#394;&#599;&#395;&#396;&#453;&#498;&#545;&#598;&#7690;&#7691;&#7692;&#7693;&#7694;&#7695;&#7696;&#7697;&#7698;&#7699;Ee&#200;&#232;&#201;&#233;&#202;&#234;&#203;&#235;&#274;&#275;&#276;&#277;&#278;&#279;&#280;&#281;&#282;&#283;&#516;&#517;&#518;&#519;&#552;&#553;&#7700;&#7701;&#7702;&#7703;&#7704;&#7705;&#7706;&#7707;&#7708;&#7709;&#7864;&#7865;&#7866;&#7867;&#7868;&#7869;&#7870;&#7871;&#7872;&#7873;&#7874;&#7875;&#7876;&#7877;&#7878;&#7879;Ff&#401;&#402;&#7710;&#7711;Gg&#284;&#285;&#286;&#287;&#288;&#289;&#290;&#291;&#403;&#608;&#484;&#485;&#486;&#487;&#500;&#501;&#7712;&#7713;Hh&#292;&#293;&#294;&#295;&#542;&#543;&#614;&#7714;&#7715;&#7716;&#7717;&#7718;&#7719;&#7720;&#7721;&#7722;&#7723;&#7830;Ii&#204;&#236;&#205;&#237;&#206;&#238;&#207;&#239;&#296;&#297;&#298;&#299;&#300;&#301;&#302;&#303;&#304;&#407;&#616;&#463;&#464;&#520;&#521;&#522;&#523;&#7724;&#7725;&#7726;&#7727;&#7880;&#7881;&#7882;&#7883;Jj&#308;&#309;&#496;&#669;Kk&#310;&#311;&#408;&#409;&#488;&#489;&#7728;&#7729;&#7730;&#7731;&#7732;&#7733;Ll&#313;&#314;&#315;&#316;&#317;&#318;&#319;&#320;&#321;&#322;&#410;&#456;&#564;&#619;&#620;&#621;&#7734;&#7735;&#7736;&#7737;&#7738;&#7739;&#7740;&#7741;Mm&#625;&#7742;&#7743;&#7744;&#7745;&#7746;&#7747;Nn&#209;&#241;&#323;&#324;&#325;&#326;&#327;&#328;&#413;&#626;&#414;&#544;&#459;&#504;&#505;&#565;&#627;&#7748;&#7749;&#7750;&#7751;&#7752;&#7753;&#7754;&#7755;Oo&#210;&#242;&#211;&#243;&#212;&#244;&#213;&#245;&#214;&#246;&#216;&#248;&#332;&#333;&#334;&#335;&#336;&#337;&#415;&#416;&#417;&#465;&#466;&#490;&#491;&#492;&#493;&#510;&#511;&#524;&#525;&#526;&#527;&#554;&#555;&#556;&#557;&#558;&#559;&#560;&#561;&#7756;&#7757;&#7758;&#7759;&#7760;&#7761;&#7762;&#7763;&#7884;&#7885;&#7886;&#7887;&#7888;&#7889;&#7890;&#7891;&#7892;&#7893;&#7894;&#7895;&#7896;&#7897;&#7898;&#7899;&#7900;&#7901;&#7902;&#7903;&#7904;&#7905;&#7906;&#7907;Pp&#420;&#421;&#7764;&#7765;&#7766;&#7767;Qq&#672;Rr&#340;&#341;&#342;&#343;&#344;&#345;&#528;&#529;&#530;&#531;&#636;&#637;&#638;&#7768;&#7769;&#7770;&#7771;&#7772;&#7773;&#7774;&#7775;Ss&#346;&#347;&#348;&#349;&#350;&#351;&#352;&#353;&#536;&#537;&#642;&#7776;&#7777;&#7778;&#7779;&#7780;&#7781;&#7782;&#7783;&#7784;&#7785;Tt&#354;&#355;&#356;&#357;&#358;&#359;&#427;&#428;&#429;&#430;&#648;&#538;&#539;&#566;&#7786;&#7787;&#7788;&#7789;&#7790;&#7791;&#7792;&#7793;&#7831;Uu&#217;&#249;&#218;&#250;&#219;&#251;&#220;&#252;&#360;&#361;&#362;&#363;&#364;&#365;&#366;&#367;&#368;&#369;&#370;&#371;&#431;&#432;&#467;&#468;&#469;&#470;&#471;&#472;&#473;&#474;&#475;&#476;&#532;&#533;&#534;&#535;&#7794;&#7795;&#7796;&#7797;&#7798;&#7799;&#7800;&#7801;&#7802;&#7803;&#7908;&#7909;&#7910;&#7911;&#7912;&#7913;&#7914;&#7915;&#7916;&#7917;&#7918;&#7919;&#7920;&#7921;Vv&#434;&#651;&#7804;&#7805;&#7806;&#7807;Ww&#372;&#373;&#7808;&#7809;&#7810;&#7811;&#7812;&#7813;&#7814;&#7815;&#7816;&#7817;&#7832;Xx&#7818;&#7819;&#7820;&#7821;Yy&#221;&#253;&#255;&#376;&#374;&#375;&#435;&#436;&#562;&#563;&#7822;&#7823;&#7833;&#7922;&#7923;&#7924;&#7925;&#7926;&#7927;&#7928;&#7929;Zz&#377;&#378;&#379;&#380;&#381;&#382;&#437;&#438;&#548;&#549;&#656;&#657;&#7824;&#7825;&#7826;&#7827;&#7828;&#7829;&#7829;', 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEFFFFFFGGGGGGGGGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIJJJJJJKKKKKKKKKKKKKKLLLLLLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMNNNNNNNNNNNNNNNNNNNNNNNNNNNOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOPPPPPPPPQQQRRRRRRRRRRRRRRRRRRRRRRRSSSSSSSSSSSSSSSSSSSSSSSTTTTTTTTTTTTTTTTTTTTTTTTTUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUVVVVVVVVWWWWWWWWWWWWWWWXXXXXXYYYYYYYYYYYYYYYYYYYYYYYZZZZZZZZZZZZZZZZZZZZZ'))"/>
+              </xsl:apply-templates>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:apply-templates select="glossentry"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </dl>
+      </xsl:when>
+      <xsl:otherwise>
+        <!-- empty glossary -->
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:if test="not(parent::article)">
+      <xsl:call-template name="process.footnotes"/>
+    </xsl:if>
+  </section>
+</xsl:template>
+
+<!-- HTML5: Put glossary in <section> element -->
+<xsl:template match="preface">
+  <xsl:call-template name="id.warning"/>
+
+  <section>
+    <xsl:call-template name="common.html.attributes">
+      <xsl:with-param name="inherit" select="1"/>
+    </xsl:call-template>
+    <xsl:if test="$generate.id.attributes != 0">
+      <xsl:attribute name="id">
+        <xsl:call-template name="object.id"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:call-template name="component.separator"/>
+    <xsl:call-template name="preface.titlepage"/>
+
+    <xsl:variable name="toc.params">
+      <xsl:call-template name="find.path.params">
+        <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:if test="contains($toc.params, 'toc')">
+      <xsl:call-template name="component.toc">
+        <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
+      </xsl:call-template>
+      <xsl:call-template name="component.toc.separator"/>
+    </xsl:if>
+    <xsl:apply-templates/>
+    <xsl:call-template name="process.footnotes"/>
+  </section>
+</xsl:template>
+
+<!-- HTML5: each dt must have a dd -->
+<xsl:template match="indexterm" mode="index-primary">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:variable name="key" select="&primary;"/>
+  <xsl:variable name="refs" select="key('primary', $key)[&scope;]"/>
+  <dt>
+    <xsl:for-each select="$refs/primary">
+      <xsl:if test="@id or @xml:id">
+        <a name="{(@id|@xml:id)[1]}"/>
+      </xsl:if>
+    </xsl:for-each>
+    <xsl:value-of select="primary"/>
+    <xsl:choose>
+      <xsl:when test="$index.links.to.section = 1">
+        <xsl:for-each select="$refs[generate-id() = generate-id(key('primary-section', concat($key, &sep;, &section.id;))[&scope;][1])]">
+          <xsl:apply-templates select="." mode="reference">
+            <xsl:with-param name="position" select="position()"/>
+            <xsl:with-param name="scope" select="$scope"/>
+            <xsl:with-param name="role" select="$role"/>
+            <xsl:with-param name="type" select="$type"/>
+          </xsl:apply-templates>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:for-each select="$refs[not(see) 
+                              and not(secondary)][&scope;]">
+          <xsl:apply-templates select="." mode="reference">
+            <xsl:with-param name="position" select="position()"/>
+            <xsl:with-param name="scope" select="$scope"/>
+            <xsl:with-param name="role" select="$role"/>
+            <xsl:with-param name="type" select="$type"/>
+          </xsl:apply-templates>
+        </xsl:for-each>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:if test="$refs[not(secondary)]/*[self::see]">
+      <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &sep;, &sep;, see))[&scope;][1])]"
+                           mode="index-see">
+        <xsl:with-param name="position" select="position()"/>
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+        <xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
+      </xsl:apply-templates>
+    </xsl:if>
+  </dt>
+  <dd>
+    <xsl:if test="$refs/secondary or $refs[not(secondary)]/*[self::seealso]">
+      <dl>
+        <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &sep;, &sep;, seealso))[&scope;][1])]"
+                             mode="index-seealso">
+          <xsl:with-param name="position" select="position()"/>
+          <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="role" select="$role"/>
+          <xsl:with-param name="type" select="$type"/>
+          <xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
+        </xsl:apply-templates>
+        <xsl:apply-templates select="$refs[secondary and count(.|key('secondary', concat($key, &sep;, &secondary;))[&scope;][1]) = 1]" 
+                             mode="index-secondary">
+          <xsl:with-param name="position" select="position()"/>
+          <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="role" select="$role"/>
+          <xsl:with-param name="type" select="$type"/>
+          <xsl:sort select="translate(&secondary;, &lowercase;, &uppercase;)"/>
+        </xsl:apply-templates>
+      </dl>
+    </xsl:if>
+  </dd>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-secondary">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:variable name="key" select="concat(&primary;, &sep;, &secondary;)"/>
+  <xsl:variable name="refs" select="key('secondary', $key)[&scope;]"/>
+  <dt>
+    <xsl:for-each select="$refs/secondary">
+      <xsl:if test="@id or @xml:id">
+        <a name="{(@id|@xml:id)[1]}"/>
+      </xsl:if>
+    </xsl:for-each>
+    <xsl:value-of select="secondary"/>
+    <xsl:choose>
+      <xsl:when test="$index.links.to.section = 1">
+        <xsl:for-each select="$refs[generate-id() = generate-id(key('secondary-section', concat($key, &sep;, &section.id;))[&scope;][1])]">
+          <xsl:apply-templates select="." mode="reference">
+            <xsl:with-param name="position" select="position()"/>
+            <xsl:with-param name="scope" select="$scope"/>
+            <xsl:with-param name="role" select="$role"/>
+            <xsl:with-param name="type" select="$type"/>
+          </xsl:apply-templates>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:for-each select="$refs[not(see) 
+                                and not(tertiary)][&scope;]">
+          <xsl:apply-templates select="." mode="reference">
+            <xsl:with-param name="position" select="position()"/>
+            <xsl:with-param name="scope" select="$scope"/>
+            <xsl:with-param name="role" select="$role"/>
+            <xsl:with-param name="type" select="$type"/>
+          </xsl:apply-templates>
+        </xsl:for-each>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:if test="$refs[not(tertiary)]/*[self::see]">
+      <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &secondary;, &sep;, &sep;, see))[&scope;][1])]"
+                           mode="index-see">
+        <xsl:with-param name="position" select="position()"/>
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+        <xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
+      </xsl:apply-templates>
+    </xsl:if>
+  </dt>
+  <dd>
+    <xsl:if test="$refs/tertiary or $refs[not(tertiary)]/*[self::seealso]">
+      <dl>
+        <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &secondary;, &sep;, &sep;, seealso))[&scope;][1])]"
+                             mode="index-seealso">
+          <xsl:with-param name="position" select="position()"/>
+          <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="role" select="$role"/>
+          <xsl:with-param name="type" select="$type"/>
+          <xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
+        </xsl:apply-templates>
+        <xsl:apply-templates select="$refs[tertiary and count(.|key('tertiary', concat($key, &sep;, &tertiary;))[&scope;][1]) = 1]" 
+                             mode="index-tertiary">
+          <xsl:with-param name="position" select="position()"/>
+          <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="role" select="$role"/>
+          <xsl:with-param name="type" select="$type"/>
+          <xsl:sort select="translate(&tertiary;, &lowercase;, &uppercase;)"/>
+        </xsl:apply-templates>
+      </dl>
+    </xsl:if>
+  </dd>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-tertiary">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:variable name="key" select="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;)"/>
+  <xsl:variable name="refs" select="key('tertiary', $key)[&scope;]"/>
+  <dt>
+    <xsl:for-each select="$refs/tertiary">
+      <xsl:if test="@id or @xml:id">
+        <a name="{(@id|@xml:id)[1]}"/>
+      </xsl:if>
+    </xsl:for-each>
+    <xsl:value-of select="tertiary"/>
+    <xsl:choose>
+      <xsl:when test="$index.links.to.section = 1">
+        <xsl:for-each select="$refs[generate-id() = generate-id(key('tertiary-section', concat($key, &sep;, &section.id;))[&scope;][1])]">
+          <xsl:apply-templates select="." mode="reference">
+            <xsl:with-param name="position" select="position()"/>
+            <xsl:with-param name="scope" select="$scope"/>
+            <xsl:with-param name="role" select="$role"/>
+            <xsl:with-param name="type" select="$type"/>
+          </xsl:apply-templates>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:for-each select="$refs[not(see)][&scope;]">
+          <xsl:apply-templates select="." mode="reference">
+            <xsl:with-param name="position" select="position()"/>
+            <xsl:with-param name="scope" select="$scope"/>
+            <xsl:with-param name="role" select="$role"/>
+            <xsl:with-param name="type" select="$type"/>
+          </xsl:apply-templates>
+        </xsl:for-each>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:if test="$refs/see">
+      <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, see))[&scope;][1])]"
+                           mode="index-see">
+        <xsl:with-param name="position" select="position()"/>
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+        <xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
+      </xsl:apply-templates>
+    </xsl:if>
+  </dt>
+  <dd>
+    <xsl:if test="$refs/seealso">
+      <dl>
+        <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, seealso))[&scope;][1])]"
+                             mode="index-seealso">
+          <xsl:with-param name="position" select="position()"/>
+          <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="role" select="$role"/>
+          <xsl:with-param name="type" select="$type"/>
+          <xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
+        </xsl:apply-templates>
+      </dl>
+    </xsl:if>
+  </dd>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-seealso">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:for-each select="seealso">
+    <xsl:sort select="translate(., &lowercase;, &uppercase;)"/>
+    <dt>
+    <xsl:text>(</xsl:text>
+    <xsl:call-template name="gentext">
+      <xsl:with-param name="key" select="'seealso'"/>
+    </xsl:call-template>
+    <xsl:text> </xsl:text>
+    <xsl:value-of select="."/>
+    <xsl:text>)</xsl:text>
+    </dt>
+    <dd/>
+  </xsl:for-each>
+</xsl:template>
+
+<xsl:template match="audiodata">
+  <xsl:variable name="filename">
+    <xsl:call-template name="mediaobject.filename">
+      <xsl:with-param name="object" select=".."/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <audio>
+    <xsl:attribute name="src">
+      <xsl:value-of select="$filename"/>
+    </xsl:attribute>
+    <xsl:attribute name="controls">controls</xsl:attribute>
+    <xsl:attribute name="autoplay"></xsl:attribute>
+  </audio>
+</xsl:template>
+
+<xsl:template match="videodata">
+  <xsl:variable name="filename">
+    <xsl:call-template name="mediaobject.filename">
+      <xsl:with-param name="object" select=".."/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <video>
+    <xsl:attribute name="src">
+      <xsl:value-of select="$filename"/>
+    </xsl:attribute>
+    <xsl:attribute name="controls">controls</xsl:attribute>
+    <xsl:attribute name="autoplay"></xsl:attribute>
+  </video>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xsl/xhtml5/onechunk.xsl b/xsl/xhtml5/onechunk.xsl
new file mode 100644 (file)
index 0000000..92e8874
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="doc">
+
+<!-- ********************************************************************
+     $Id: onechunk.xsl,v 1.1 2011-09-16 21:44:00 bobs Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://docbook.sf.net/release/xsl/current/ for
+     copyright and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<xsl:import href="chunk.xsl"/>
+
+<!-- Ok, using the onechunk parameter makes this all work again. -->
+<!-- It does have the disadvantage that it only works for documents that have -->
+<!-- a root element that is considered a chunk by the chunk.xsl stylesheet. -->
+<!-- Ideally, onechunk would let anything be a chunk. But not today. -->
+
+<xsl:param name="onechunk" select="1"/>
+<xsl:param name="suppress.navigation">1</xsl:param>
+
+<xsl:template name="href.target.uri">
+  <xsl:param name="object" select="."/>
+  <xsl:text>#</xsl:text>
+  <xsl:call-template name="object.id">
+    <xsl:with-param name="object" select="$object"/>
+  </xsl:call-template>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xsl/xhtml5/profile-chunk.xsl b/xsl/xhtml5/profile-chunk.xsl
new file mode 100644 (file)
index 0000000..4db061a
--- /dev/null
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="exsl">
+
+<!-- ********************************************************************
+     $Id: profile-chunk.xsl,v 1.1 2011-09-16 21:44:00 bobs Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://docbook.sf.net/release/xsl/current/ for
+     copyright and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<!-- First import the non-chunking templates that format elements
+     within each chunk file. In a customization, you should
+     create a separate non-chunking customization layer such
+     as mydocbook.xsl that imports the original docbook.xsl and
+     customizes any presentation templates. Then your chunking
+     customization should import mydocbook.xsl instead of
+     docbook.xsl.  -->
+<xsl:import href="docbook.xsl"/>
+
+<!-- chunk-common.xsl contains all the named templates for chunking.
+     In a customization file, you import chunk-common.xsl, then
+     add any customized chunking templates of the same name. 
+     They will have import precedence over the original 
+     chunking templates in chunk-common.xsl. -->
+<xsl:import href="../xhtml/chunk-common.xsl"/>
+
+<!-- The manifest.xsl module is no longer imported because its
+     templates were moved into chunk-common and chunk-code -->
+
+<!-- chunk-code.xsl contains all the chunking templates that use
+     a match attribute.  In a customization it should be referenced
+     using <xsl:include> instead of <xsl:import>, and then add
+     any customized chunking templates with match attributes. But be sure
+     to add a priority="1" to such customized templates to resolve
+     its conflict with the original, since they have the
+     same import precedence.
+     
+     Using xsl:include prevents adding another layer
+     of import precedence, which would cause any
+     customizations that use xsl:apply-imports to wrongly
+     apply the chunking version instead of the original
+     non-chunking version to format an element.  -->
+<xsl:include href="../xhtml/profile-chunk-code.xsl"/>
+
+<xsl:include href="html5-chunk-mods.xsl"/>
+
+</xsl:stylesheet>
diff --git a/xsl/xhtml5/profile-docbook.xsl b/xsl/xhtml5/profile-docbook.xsl
new file mode 100644 (file)
index 0000000..6d1a9a6
--- /dev/null
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets.-->
+<!--This file was created automatically by xsl2profile-->
+<!--from the DocBook XSL stylesheets.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ng="http://docbook.org/docbook-ng" xmlns:db="http://docbook.org/ns/docbook" xmlns:exsl="http://exslt.org/common" xmlns:exslt="http://exslt.org/common" xmlns="http://www.w3.org/1999/xhtml" exslt:dummy="dummy" ng:dummy="dummy" db:dummy="dummy" extension-element-prefixes="exslt" exclude-result-prefixes="db ng exsl exslt exslt" version="1.0">
+
+
+<!-- ********************************************************************
+     $Id: profile-docbook.xsl,v 1.2 2011-09-18 17:47:28 bobs Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://docbook.sf.net/release/xsl/current/ for
+     copyright and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<xsl:import href="xhtml-profile-docbook.xsl"/>
+
+<xsl:include href="html5-element-mods.xsl"/>
+
+<xsl:output method="xml" encoding="UTF-8" indent="no"/>
+
+</xsl:stylesheet>
diff --git a/xsl/xhtml5/xhtml-docbook.xsl b/xsl/xhtml5/xhtml-docbook.xsl
new file mode 100644 (file)
index 0000000..1414fd6
--- /dev/null
@@ -0,0 +1,448 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ng="http://docbook.org/docbook-ng" xmlns:db="http://docbook.org/ns/docbook" xmlns:exsl="http://exslt.org/common" xmlns:exslt="http://exslt.org/common" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="db ng exsl exslt" version="1.0">
+
+<!-- Same as xhtml but with doctypes removed from xsl:output -->
+<!-- and including from ../xhtml directory -->
+<xsl:output method="xml" encoding="UTF-8" indent="no"/>
+
+<!-- ********************************************************************
+     $Id: xhtml-docbook.xsl,v 1.1 2011-09-16 21:44:00 bobs Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://docbook.sf.net/release/xsl/current/ for
+     copyright and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<xsl:include href="../VERSION"/>
+<xsl:include href="../xhtml/param.xsl"/>
+<xsl:include href="../lib/lib.xsl"/>
+<xsl:include href="../common/l10n.xsl"/>
+<xsl:include href="../common/common.xsl"/>
+<xsl:include href="../common/utility.xsl"/>
+<xsl:include href="../common/labels.xsl"/>
+<xsl:include href="../common/titles.xsl"/>
+<xsl:include href="../common/subtitles.xsl"/>
+<xsl:include href="../common/gentext.xsl"/>
+<xsl:include href="../common/targets.xsl"/>
+<xsl:include href="../common/olink.xsl"/>
+<xsl:include href="../common/pi.xsl"/>
+<xsl:include href="../xhtml/autotoc.xsl"/>
+<xsl:include href="../xhtml/autoidx.xsl"/>
+<xsl:include href="../xhtml/lists.xsl"/>
+<xsl:include href="../xhtml/callout.xsl"/>
+<xsl:include href="../xhtml/verbatim.xsl"/>
+<xsl:include href="../xhtml/graphics.xsl"/>
+<xsl:include href="../xhtml/xref.xsl"/>
+<xsl:include href="../xhtml/formal.xsl"/>
+<xsl:include href="../xhtml/table.xsl"/>
+<xsl:include href="../xhtml/htmltbl.xsl"/>
+<xsl:include href="../xhtml/sections.xsl"/>
+<xsl:include href="../xhtml/inline.xsl"/>
+<xsl:include href="../xhtml/footnote.xsl"/>
+<xsl:include href="../xhtml/html.xsl"/>
+<xsl:include href="../xhtml/info.xsl"/>
+<xsl:include href="../xhtml/keywords.xsl"/>
+<xsl:include href="../xhtml/division.xsl"/>
+<xsl:include href="../xhtml/toc.xsl"/>
+<xsl:include href="../xhtml/index.xsl"/>
+<xsl:include href="../xhtml/refentry.xsl"/>
+<xsl:include href="../xhtml/math.xsl"/>
+<xsl:include href="../xhtml/admon.xsl"/>
+<xsl:include href="../xhtml/component.xsl"/>
+<xsl:include href="../xhtml/biblio.xsl"/>
+<xsl:include href="../xhtml/biblio-iso690.xsl"/>
+<xsl:include href="../xhtml/glossary.xsl"/>
+<xsl:include href="../xhtml/block.xsl"/>
+<xsl:include href="../xhtml/task.xsl"/>
+<xsl:include href="../xhtml/qandaset.xsl"/>
+<xsl:include href="../xhtml/synop.xsl"/>
+<xsl:include href="../xhtml/titlepage.xsl"/>
+<xsl:include href="../xhtml/titlepage.templates.xsl"/>
+<xsl:include href="../xhtml/pi.xsl"/>
+<xsl:include href="../xhtml/ebnf.xsl"/>
+<xsl:include href="../xhtml/chunker.xsl"/>
+<xsl:include href="../xhtml/html-rtf.xsl"/>
+<xsl:include href="../xhtml/annotations.xsl"/>
+<xsl:include href="../common/stripns.xsl"/>
+
+<xsl:param name="stylesheet.result.type" select="'xhtml'"/>
+<xsl:param name="htmlhelp.output" select="0"/>
+
+<!-- ==================================================================== -->
+
+<xsl:key name="id" match="*" use="@id|@xml:id"/>
+<xsl:key name="gid" match="*" use="generate-id()"/>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="*">
+  <xsl:message>
+    <xsl:text>Element </xsl:text>
+    <xsl:value-of select="local-name(.)"/>
+    <xsl:text> in namespace '</xsl:text>
+    <xsl:value-of select="namespace-uri(.)"/>
+    <xsl:text>' encountered</xsl:text>
+    <xsl:if test="parent::*">
+      <xsl:text> in </xsl:text>
+      <xsl:value-of select="name(parent::*)"/>
+    </xsl:if>
+    <xsl:text>, but no template matches.</xsl:text>
+  </xsl:message>
+
+  <span style="color: red">
+    <xsl:text>&lt;</xsl:text>
+    <xsl:value-of select="name(.)"/>
+    <xsl:text>&gt;</xsl:text>
+    <xsl:apply-templates/>
+    <xsl:text>&lt;/</xsl:text>
+    <xsl:value-of select="name(.)"/>
+    <xsl:text>&gt;</xsl:text>
+  </span>
+</xsl:template>
+
+<xsl:template match="text()">
+  <xsl:value-of select="."/>
+</xsl:template>
+
+<xsl:template name="body.attributes"><xslo:if xmlns:xslo="http://www.w3.org/1999/XSL/Transform" test="starts-with($writing.mode, 'rl')"><xslo:attribute name="dir">rtl</xslo:attribute></xslo:if>
+<!-- no apply-templates; make it empty except for dir for rtl-->
+</xsl:template>
+
+<xsl:template name="head.content">
+  <xsl:param name="node" select="."/>
+  <xsl:param name="title">
+    <xsl:apply-templates select="$node" mode="object.title.markup.textonly"/>
+  </xsl:param>
+
+  <title>
+    <xsl:copy-of select="$title"/>
+  </title>
+
+  <xsl:if test="$html.base != ''">
+    <base href="{$html.base}"/>
+  </xsl:if>
+
+  <!-- Insert links to CSS files or insert literal style elements -->
+  <xsl:call-template name="generate.css"/>
+
+  <xsl:if test="$html.stylesheet != ''">
+    <xsl:call-template name="output.html.stylesheets">
+      <xsl:with-param name="stylesheets" select="normalize-space($html.stylesheet)"/>
+    </xsl:call-template>
+  </xsl:if>
+
+  <xsl:if test="$link.mailto.url != ''">
+    <link rev="made" href="{$link.mailto.url}"/>
+  </xsl:if>
+
+  <meta name="generator" content="DocBook {$DistroTitle} V{$VERSION}"/>
+
+  <xsl:if test="$generate.meta.abstract != 0">
+    <xsl:variable name="info" select="(articleinfo                                       |bookinfo                                       |prefaceinfo                                       |chapterinfo                                       |appendixinfo                                       |sectioninfo                                       |sect1info                                       |sect2info                                       |sect3info                                       |sect4info                                       |sect5info                                       |referenceinfo                                       |refentryinfo                                       |partinfo                                       |info                                       |docinfo)[1]"/>
+    <xsl:if test="$info and $info/abstract">
+      <meta name="description">
+        <xsl:attribute name="content">
+          <xsl:for-each select="$info/abstract[1]/*">
+            <xsl:value-of select="normalize-space(.)"/>
+            <xsl:if test="position() &lt; last()">
+              <xsl:text> </xsl:text>
+            </xsl:if>
+          </xsl:for-each>
+        </xsl:attribute>
+      </meta>
+    </xsl:if>
+  </xsl:if>
+
+  <xsl:if test="($draft.mode = 'yes' or                 ($draft.mode = 'maybe' and                 ancestor-or-self::*[@status][1]/@status = 'draft'))                 and $draft.watermark.image != ''">
+    <style type="text/css"><xsl:text>
+body { background-image: url('</xsl:text>
+<xsl:value-of select="$draft.watermark.image"/><xsl:text>');
+       background-repeat: no-repeat;
+       background-position: top left;
+       /* The following properties make the watermark "fixed" on the page. */
+       /* I think that's just a bit too distracting for the reader... */
+       /* background-attachment: fixed; */
+       /* background-position: center center; */
+     }</xsl:text>
+    </style>
+  </xsl:if>
+  <xsl:apply-templates select="." mode="head.keywords.content"/>
+</xsl:template>
+
+<xsl:template name="output.html.stylesheets">
+  <xsl:param name="stylesheets" select="''"/>
+
+  <xsl:choose>
+    <xsl:when test="contains($stylesheets, ' ')">
+      <xsl:variable name="css.filename" select="substring-before($stylesheets, ' ')"/>
+
+      <xsl:call-template name="make.css.link">
+        <xsl:with-param name="css.filename" select="$css.filename"/>
+      </xsl:call-template>
+
+      <xsl:call-template name="output.html.stylesheets">
+        <xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$stylesheets != ''">
+      <xsl:call-template name="make.css.link">
+        <xsl:with-param name="css.filename" select="$stylesheets"/>
+      </xsl:call-template>
+    </xsl:when>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ============================================================ -->
+
+<xsl:template match="*" mode="head.keywords.content">
+  <xsl:apply-templates select="chapterinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="appendixinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="prefaceinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="bookinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="setinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="articleinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="artheader/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sect1info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sect2info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sect3info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sect4info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sect5info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sectioninfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="refsect1info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="refsect2info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="refsect3info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="bibliographyinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="glossaryinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="indexinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="refentryinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="partinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="referenceinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="docinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="info/keywordset" mode="html.header"/>
+
+  <xsl:if test="$inherit.keywords != 0                 and parent::*">
+    <xsl:apply-templates select="parent::*" mode="head.keywords.content"/>
+  </xsl:if>
+</xsl:template>
+
+<!-- ============================================================ -->
+
+<xsl:template name="system.head.content">
+  <xsl:param name="node" select="."/>
+
+  <!-- FIXME: When chunking, only the annotations actually used
+              in this chunk should be referenced. I don't think it
+              does any harm to reference them all, but it adds
+              unnecessary bloat to each chunk. -->
+  <xsl:if test="$annotation.support != 0 and //annotation">
+    <xsl:call-template name="add.annotation.links"/>
+    <script type="text/javascript">
+      <xsl:text>
+// Create PopupWindow objects</xsl:text>
+      <xsl:for-each select="//annotation">
+        <xsl:text>
+var popup_</xsl:text>
+        <xsl:value-of select="generate-id(.)"/>
+        <xsl:text> = new PopupWindow("popup-</xsl:text>
+        <xsl:value-of select="generate-id(.)"/>
+        <xsl:text>");
+</xsl:text>
+        <xsl:text>popup_</xsl:text>
+        <xsl:value-of select="generate-id(.)"/>
+        <xsl:text>.offsetY = 15;
+</xsl:text>
+        <xsl:text>popup_</xsl:text>
+        <xsl:value-of select="generate-id(.)"/>
+        <xsl:text>.autoHide();
+</xsl:text>
+      </xsl:for-each>
+    </script>
+
+    <style type="text/css">
+      <xsl:value-of select="$annotation.css"/>
+    </style>
+  </xsl:if>
+
+  <!-- system.head.content is like user.head.content, except that
+       it is called before head.content. This is important because it
+       means, for example, that <style> elements output by system.head.content
+       have a lower CSS precedence than the users stylesheet. -->
+</xsl:template>
+
+<!-- ============================================================ -->
+
+<xsl:template name="user.preroot">
+  <!-- Pre-root output, can be used to output comments and PIs. -->
+  <!-- This must not output any element content! -->
+</xsl:template>
+
+<xsl:template name="user.head.content">
+  <xsl:param name="node" select="."/>
+</xsl:template>
+
+<xsl:template name="user.header.navigation">
+  <xsl:param name="node" select="."/>
+</xsl:template>
+
+<xsl:template name="user.header.content">
+  <xsl:param name="node" select="."/>
+</xsl:template>
+
+<xsl:template name="user.footer.content">
+  <xsl:param name="node" select="."/>
+</xsl:template>
+
+<xsl:template name="user.footer.navigation">
+  <xsl:param name="node" select="."/>
+</xsl:template>
+
+<xsl:template match="/">
+  <!-- * Get a title for current doc so that we let the user -->
+  <!-- * know what document we are processing at this point. -->
+  <xsl:variable name="doc.title">
+    <xsl:call-template name="get.doc.title"/>
+  </xsl:variable>
+  <xsl:choose>
+    <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
+         toss the namespace and continue.  Use the docbook5 namespaced
+         stylesheets for DocBook5 if you don't want to use this feature.-->
+    <!-- include extra test for Xalan quirk -->
+    <xsl:when test="$exsl.node.set.available != 0                     and (*/self::ng:* or */self::db:*)">
+      <xsl:call-template name="log.message">
+        <xsl:with-param name="level">Note</xsl:with-param>
+        <xsl:with-param name="source" select="$doc.title"/>
+        <xsl:with-param name="context-desc">
+          <xsl:text>namesp. cut</xsl:text>
+        </xsl:with-param>
+        <xsl:with-param name="message">
+          <xsl:text>stripped namespace before processing</xsl:text>
+        </xsl:with-param>
+      </xsl:call-template>
+      <xsl:variable name="nons">
+        <xsl:apply-templates mode="stripNS"/>
+      </xsl:variable>
+      <!--
+      <xsl:message>Saving stripped document.</xsl:message>
+      <xsl:call-template name="write.chunk">
+        <xsl:with-param name="filename" select="'/tmp/stripped.xml'"/>
+        <xsl:with-param name="method" select="'xml'"/>
+        <xsl:with-param name="content">
+          <xsl:copy-of select="exsl:node-set($nons)"/>
+        </xsl:with-param>
+      </xsl:call-template>
+      -->
+      <xsl:call-template name="log.message">
+        <xsl:with-param name="level">Note</xsl:with-param>
+        <xsl:with-param name="source" select="$doc.title"/>
+        <xsl:with-param name="context-desc">
+          <xsl:text>namesp. cut</xsl:text>
+        </xsl:with-param>
+        <xsl:with-param name="message">
+          <xsl:text>processing stripped document</xsl:text>
+        </xsl:with-param>
+      </xsl:call-template>
+      <xsl:apply-templates select="exsl:node-set($nons)"/>
+    </xsl:when>
+    <!-- Can't process unless namespace removed -->
+    <xsl:when test="*/self::ng:* or */self::db:*">
+      <xsl:message terminate="yes">
+        <xsl:text>Unable to strip the namespace from DB5 document,</xsl:text>
+        <xsl:text> cannot proceed.</xsl:text>
+      </xsl:message>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:choose>
+        <xsl:when test="$rootid != ''">
+          <xsl:choose>
+            <xsl:when test="count(key('id',$rootid)) = 0">
+              <xsl:message terminate="yes">
+                <xsl:text>ID '</xsl:text>
+                <xsl:value-of select="$rootid"/>
+                <xsl:text>' not found in document.</xsl:text>
+              </xsl:message>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:if test="$collect.xref.targets = 'yes' or                             $collect.xref.targets = 'only'">
+                <xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/>
+              </xsl:if>
+              <xsl:if test="$collect.xref.targets != 'only'">
+                <xsl:apply-templates select="key('id',$rootid)" mode="process.root"/>
+                <xsl:if test="$tex.math.in.alt != ''">
+                  <xsl:apply-templates select="key('id',$rootid)" mode="collect.tex.math"/>
+                </xsl:if>
+              </xsl:if>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:if test="$collect.xref.targets = 'yes' or                         $collect.xref.targets = 'only'">
+            <xsl:apply-templates select="/" mode="collect.targets"/>
+          </xsl:if>
+          <xsl:if test="$collect.xref.targets != 'only'">
+            <xsl:apply-templates select="/" mode="process.root"/>
+            <xsl:if test="$tex.math.in.alt != ''">
+              <xsl:apply-templates select="/" mode="collect.tex.math"/>
+            </xsl:if>
+          </xsl:if>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="*" mode="process.root">
+  <xsl:variable name="doc" select="self::*"/>
+
+  <xsl:call-template name="user.preroot"/>
+  <xsl:call-template name="root.messages"/>
+
+  <html>
+    <head>
+      <xsl:call-template name="system.head.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+      <xsl:call-template name="head.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+      <xsl:call-template name="user.head.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+    </head>
+    <body>
+      <xsl:call-template name="body.attributes"/>
+      <xsl:call-template name="user.header.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+      <xsl:apply-templates select="."/>
+      <xsl:call-template name="user.footer.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+    </body>
+  </html>
+  <xsl:value-of select="$html.append"/>
+  
+  <!-- Generate any css files only once, not once per chunk -->
+  <xsl:call-template name="generate.css.files"/>
+</xsl:template>
+
+<xsl:template name="root.messages">
+  <!-- redefine this any way you'd like to output messages -->
+  <!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE -->
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="chunk">
+  <xsl:param name="node" select="."/>
+
+  <!-- The default is that we are not chunking... -->
+  <xsl:text>0</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xsl/xhtml5/xhtml-profile-docbook.xsl b/xsl/xhtml5/xhtml-profile-docbook.xsl
new file mode 100644 (file)
index 0000000..7ee26b7
--- /dev/null
@@ -0,0 +1,408 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets.-->
+<!--This file was created automatically by xsl2profile-->
+<!--from the DocBook XSL stylesheets.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ng="http://docbook.org/docbook-ng" xmlns:db="http://docbook.org/ns/docbook" xmlns:exsl="http://exslt.org/common" xmlns:exslt="http://exslt.org/common" xmlns="http://www.w3.org/1999/xhtml" exslt:dummy="dummy" ng:dummy="dummy" db:dummy="dummy" extension-element-prefixes="exslt" exclude-result-prefixes="db ng exsl exslt exslt" version="1.0">
+
+<xsl:output method="xml" encoding="UTF-8" indent="no"/>
+
+<!-- ********************************************************************
+     $Id: xhtml-profile-docbook.xsl,v 1.1 2011-09-16 21:44:00 bobs Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://docbook.sf.net/release/xsl/current/ for
+     copyright and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<xsl:include href="../VERSION"/>
+<xsl:include href="../xhtml/param.xsl"/>
+<xsl:include href="../lib/lib.xsl"/>
+<xsl:include href="../common/l10n.xsl"/>
+<xsl:include href="../common/common.xsl"/>
+<xsl:include href="../common/utility.xsl"/>
+<xsl:include href="../common/labels.xsl"/>
+<xsl:include href="../common/titles.xsl"/>
+<xsl:include href="../common/subtitles.xsl"/>
+<xsl:include href="../common/gentext.xsl"/>
+<xsl:include href="../common/targets.xsl"/>
+<xsl:include href="../common/olink.xsl"/>
+<xsl:include href="../common/pi.xsl"/>
+<xsl:include href="../xhtml/autotoc.xsl"/>
+<xsl:include href="../xhtml/autoidx.xsl"/>
+<xsl:include href="../xhtml/lists.xsl"/>
+<xsl:include href="../xhtml/callout.xsl"/>
+<xsl:include href="../xhtml/verbatim.xsl"/>
+<xsl:include href="../xhtml/graphics.xsl"/>
+<xsl:include href="../xhtml/xref.xsl"/>
+<xsl:include href="../xhtml/formal.xsl"/>
+<xsl:include href="../xhtml/table.xsl"/>
+<xsl:include href="../xhtml/htmltbl.xsl"/>
+<xsl:include href="../xhtml/sections.xsl"/>
+<xsl:include href="../xhtml/inline.xsl"/>
+<xsl:include href="../xhtml/footnote.xsl"/>
+<xsl:include href="../xhtml/html.xsl"/>
+<xsl:include href="../xhtml/info.xsl"/>
+<xsl:include href="../xhtml/keywords.xsl"/>
+<xsl:include href="../xhtml/division.xsl"/>
+<xsl:include href="../xhtml/toc.xsl"/>
+<xsl:include href="../xhtml/index.xsl"/>
+<xsl:include href="../xhtml/refentry.xsl"/>
+<xsl:include href="../xhtml/math.xsl"/>
+<xsl:include href="../xhtml/admon.xsl"/>
+<xsl:include href="../xhtml/component.xsl"/>
+<xsl:include href="../xhtml/biblio.xsl"/>
+<xsl:include href="../xhtml/biblio-iso690.xsl"/>
+<xsl:include href="../xhtml/glossary.xsl"/>
+<xsl:include href="../xhtml/block.xsl"/>
+<xsl:include href="../xhtml/task.xsl"/>
+<xsl:include href="../xhtml/qandaset.xsl"/>
+<xsl:include href="../xhtml/synop.xsl"/>
+<xsl:include href="../xhtml/titlepage.xsl"/>
+<xsl:include href="../xhtml/titlepage.templates.xsl"/>
+<xsl:include href="../xhtml/pi.xsl"/>
+<xsl:include href="../xhtml/ebnf.xsl"/>
+<xsl:include href="../xhtml/chunker.xsl"/>
+<xsl:include href="../xhtml/html-rtf.xsl"/>
+<xsl:include href="../xhtml/annotations.xsl"/>
+<xsl:include href="../common/stripns.xsl"/>
+
+<xsl:param name="stylesheet.result.type" select="'xhtml'"/>
+<xsl:param name="htmlhelp.output" select="0"/>
+
+<!-- ==================================================================== -->
+
+<xsl:key name="id" match="*" use="@id|@xml:id"/>
+<xsl:key name="gid" match="*" use="generate-id()"/>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="*">
+  <xsl:message>
+    <xsl:text>Element </xsl:text>
+    <xsl:value-of select="local-name(.)"/>
+    <xsl:text> in namespace '</xsl:text>
+    <xsl:value-of select="namespace-uri(.)"/>
+    <xsl:text>' encountered</xsl:text>
+    <xsl:if test="parent::*">
+      <xsl:text> in </xsl:text>
+      <xsl:value-of select="name(parent::*)"/>
+    </xsl:if>
+    <xsl:text>, but no template matches.</xsl:text>
+  </xsl:message>
+
+  <span style="color: red">
+    <xsl:text>&lt;</xsl:text>
+    <xsl:value-of select="name(.)"/>
+    <xsl:text>&gt;</xsl:text>
+    <xsl:apply-templates/>
+    <xsl:text>&lt;/</xsl:text>
+    <xsl:value-of select="name(.)"/>
+    <xsl:text>&gt;</xsl:text>
+  </span>
+</xsl:template>
+
+<xsl:template match="text()">
+  <xsl:value-of select="."/>
+</xsl:template>
+
+<xsl:template name="body.attributes"><xslo:if xmlns:xslo="http://www.w3.org/1999/XSL/Transform" test="starts-with($writing.mode, 'rl')"><xslo:attribute name="dir">rtl</xslo:attribute></xslo:if>
+<!-- no apply-templates; make it empty except for dir for rtl-->
+</xsl:template>
+
+<xsl:template name="head.content">
+  <xsl:param name="node" select="."/>
+  <xsl:param name="title">
+    <xsl:apply-templates select="$node" mode="object.title.markup.textonly"/>
+  </xsl:param>
+
+  <title>
+    <xsl:copy-of select="$title"/>
+  </title>
+
+  <xsl:if test="$html.base != ''">
+    <base href="{$html.base}"/>
+  </xsl:if>
+
+  <!-- Insert links to CSS files or insert literal style elements -->
+  <xsl:call-template name="generate.css"/>
+
+  <xsl:if test="$html.stylesheet != ''">
+    <xsl:call-template name="output.html.stylesheets">
+      <xsl:with-param name="stylesheets" select="normalize-space($html.stylesheet)"/>
+    </xsl:call-template>
+  </xsl:if>
+
+  <xsl:if test="$link.mailto.url != ''">
+    <link rev="made" href="{$link.mailto.url}"/>
+  </xsl:if>
+
+  <meta name="generator" content="DocBook {$DistroTitle} V{$VERSION}"/>
+
+  <xsl:if test="$generate.meta.abstract != 0">
+    <xsl:variable name="info" select="(articleinfo                                       |bookinfo                                       |prefaceinfo                                       |chapterinfo                                       |appendixinfo                                       |sectioninfo                                       |sect1info                                       |sect2info                                       |sect3info                                       |sect4info                                       |sect5info                                       |referenceinfo                                       |refentryinfo                                       |partinfo                                       |info                                       |docinfo)[1]"/>
+    <xsl:if test="$info and $info/abstract">
+      <meta name="description">
+        <xsl:attribute name="content">
+          <xsl:for-each select="$info/abstract[1]/*">
+            <xsl:value-of select="normalize-space(.)"/>
+            <xsl:if test="position() &lt; last()">
+              <xsl:text> </xsl:text>
+            </xsl:if>
+          </xsl:for-each>
+        </xsl:attribute>
+      </meta>
+    </xsl:if>
+  </xsl:if>
+
+  <xsl:if test="($draft.mode = 'yes' or                 ($draft.mode = 'maybe' and                 ancestor-or-self::*[@status][1]/@status = 'draft'))                 and $draft.watermark.image != ''">
+    <style type="text/css"><xsl:text>
+body { background-image: url('</xsl:text>
+<xsl:value-of select="$draft.watermark.image"/><xsl:text>');
+       background-repeat: no-repeat;
+       background-position: top left;
+       /* The following properties make the watermark "fixed" on the page. */
+       /* I think that's just a bit too distracting for the reader... */
+       /* background-attachment: fixed; */
+       /* background-position: center center; */
+     }</xsl:text>
+    </style>
+  </xsl:if>
+  <xsl:apply-templates select="." mode="head.keywords.content"/>
+</xsl:template>
+
+<xsl:template name="output.html.stylesheets">
+  <xsl:param name="stylesheets" select="''"/>
+
+  <xsl:choose>
+    <xsl:when test="contains($stylesheets, ' ')">
+      <xsl:variable name="css.filename" select="substring-before($stylesheets, ' ')"/>
+
+      <xsl:call-template name="make.css.link">
+        <xsl:with-param name="css.filename" select="$css.filename"/>
+      </xsl:call-template>
+
+      <xsl:call-template name="output.html.stylesheets">
+        <xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$stylesheets != ''">
+      <xsl:call-template name="make.css.link">
+        <xsl:with-param name="css.filename" select="$stylesheets"/>
+      </xsl:call-template>
+    </xsl:when>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ============================================================ -->
+
+<xsl:template match="*" mode="head.keywords.content">
+  <xsl:apply-templates select="chapterinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="appendixinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="prefaceinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="bookinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="setinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="articleinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="artheader/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sect1info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sect2info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sect3info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sect4info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sect5info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sectioninfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="refsect1info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="refsect2info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="refsect3info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="bibliographyinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="glossaryinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="indexinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="refentryinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="partinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="referenceinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="docinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="info/keywordset" mode="html.header"/>
+
+  <xsl:if test="$inherit.keywords != 0                 and parent::*">
+    <xsl:apply-templates select="parent::*" mode="head.keywords.content"/>
+  </xsl:if>
+</xsl:template>
+
+<!-- ============================================================ -->
+
+<xsl:template name="system.head.content">
+  <xsl:param name="node" select="."/>
+
+  <!-- FIXME: When chunking, only the annotations actually used
+              in this chunk should be referenced. I don't think it
+              does any harm to reference them all, but it adds
+              unnecessary bloat to each chunk. -->
+  <xsl:if test="$annotation.support != 0 and //annotation">
+    <xsl:call-template name="add.annotation.links"/>
+    <script type="text/javascript">
+      <xsl:text>
+// Create PopupWindow objects</xsl:text>
+      <xsl:for-each select="//annotation">
+        <xsl:text>
+var popup_</xsl:text>
+        <xsl:value-of select="generate-id(.)"/>
+        <xsl:text> = new PopupWindow("popup-</xsl:text>
+        <xsl:value-of select="generate-id(.)"/>
+        <xsl:text>");
+</xsl:text>
+        <xsl:text>popup_</xsl:text>
+        <xsl:value-of select="generate-id(.)"/>
+        <xsl:text>.offsetY = 15;
+</xsl:text>
+        <xsl:text>popup_</xsl:text>
+        <xsl:value-of select="generate-id(.)"/>
+        <xsl:text>.autoHide();
+</xsl:text>
+      </xsl:for-each>
+    </script>
+
+    <style type="text/css">
+      <xsl:value-of select="$annotation.css"/>
+    </style>
+  </xsl:if>
+
+  <!-- system.head.content is like user.head.content, except that
+       it is called before head.content. This is important because it
+       means, for example, that <style> elements output by system.head.content
+       have a lower CSS precedence than the users stylesheet. -->
+</xsl:template>
+
+<!-- ============================================================ -->
+
+<xsl:template name="user.preroot">
+  <!-- Pre-root output, can be used to output comments and PIs. -->
+  <!-- This must not output any element content! -->
+</xsl:template>
+
+<xsl:template name="user.head.content">
+  <xsl:param name="node" select="."/>
+</xsl:template>
+
+<xsl:template name="user.header.navigation">
+  <xsl:param name="node" select="."/>
+</xsl:template>
+
+<xsl:template name="user.header.content">
+  <xsl:param name="node" select="."/>
+</xsl:template>
+
+<xsl:template name="user.footer.content">
+  <xsl:param name="node" select="."/>
+</xsl:template>
+
+<xsl:template name="user.footer.navigation">
+  <xsl:param name="node" select="."/>
+</xsl:template>
+
+<xslo:include xmlns:xslo="http://www.w3.org/1999/XSL/Transform" href="../profiling/profile-mode.xsl"/><xslo:variable xmlns:xslo="http://www.w3.org/1999/XSL/Transform" name="profiled-content"><xslo:choose><xslo:when test="*/self::ng:* or */self::db:*"><xslo:message>Note: namesp. cut : stripped namespace before processing</xslo:message><xslo:variable name="stripped-content"><xslo:apply-templates select="/" mode="stripNS"/></xslo:variable><xslo:message>Note: namesp. cut : processing stripped document</xslo:message><xslo:apply-templates select="exslt:node-set($stripped-content)" mode="profile"/></xslo:when><xslo:otherwise><xslo:apply-templates select="/" mode="profile"/></xslo:otherwise></xslo:choose></xslo:variable><xslo:variable xmlns:xslo="http://www.w3.org/1999/XSL/Transform" name="profiled-nodes" select="exslt:node-set($profiled-content)"/><xsl:template match="/">
+  <!-- * Get a title for current doc so that we let the user -->
+  <!-- * know what document we are processing at this point. -->
+  <xsl:variable name="doc.title">
+    <xsl:call-template name="get.doc.title"/>
+  </xsl:variable>
+  <xsl:choose>
+    <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
+         toss the namespace and continue.  Use the docbook5 namespaced
+         stylesheets for DocBook5 if you don't want to use this feature.-->
+    <!-- include extra test for Xalan quirk -->
+    <xsl:when test="false()"/>
+    <!-- Can't process unless namespace removed -->
+    <xsl:when test="false()"/>
+    <xsl:otherwise>
+      <xsl:choose>
+        <xsl:when test="$rootid != ''">
+          <xsl:choose>
+            <xsl:when test="count($profiled-nodes//*[@id=$rootid]) = 0">
+              <xsl:message terminate="yes">
+                <xsl:text>ID '</xsl:text>
+                <xsl:value-of select="$rootid"/>
+                <xsl:text>' not found in document.</xsl:text>
+              </xsl:message>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:if test="$collect.xref.targets = 'yes' or                             $collect.xref.targets = 'only'">
+                <xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/>
+              </xsl:if>
+              <xsl:if test="$collect.xref.targets != 'only'">
+                <xsl:apply-templates select="$profiled-nodes//*[@id=$rootid]" mode="process.root"/>
+                <xsl:if test="$tex.math.in.alt != ''">
+                  <xsl:apply-templates select="$profiled-nodes//*[@id=$rootid]" mode="collect.tex.math"/>
+                </xsl:if>
+              </xsl:if>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:if test="$collect.xref.targets = 'yes' or                         $collect.xref.targets = 'only'">
+            <xsl:apply-templates select="$profiled-nodes" mode="collect.targets"/>
+          </xsl:if>
+          <xsl:if test="$collect.xref.targets != 'only'">
+            <xsl:apply-templates select="$profiled-nodes" mode="process.root"/>
+            <xsl:if test="$tex.math.in.alt != ''">
+              <xsl:apply-templates select="$profiled-nodes" mode="collect.tex.math"/>
+            </xsl:if>
+          </xsl:if>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="*" mode="process.root">
+  <xsl:variable name="doc" select="self::*"/>
+
+  <xsl:call-template name="user.preroot"/>
+  <xsl:call-template name="root.messages"/>
+
+  <html>
+    <head>
+      <xsl:call-template name="system.head.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+      <xsl:call-template name="head.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+      <xsl:call-template name="user.head.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+    </head>
+    <body>
+      <xsl:call-template name="body.attributes"/>
+      <xsl:call-template name="user.header.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+      <xsl:apply-templates select="."/>
+      <xsl:call-template name="user.footer.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+    </body>
+  </html>
+  <xsl:value-of select="$html.append"/>
+  
+  <!-- Generate any css files only once, not once per chunk -->
+  <xsl:call-template name="generate.css.files"/>
+</xsl:template>
+
+<xsl:template name="root.messages">
+  <!-- redefine this any way you'd like to output messages -->
+  <!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE -->
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="chunk">
+  <xsl:param name="node" select="."/>
+
+  <!-- The default is that we are not chunking... -->
+  <xsl:text>0</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>