]> granicus.if.org Git - docbook-dsssl/commitdiff
Refactored due to better support for html5 within the base html stylesheets.
authorBob Stayton <bobs@sagehill.net>
Sat, 2 Jun 2012 20:14:04 +0000 (20:14 +0000)
committerBob Stayton <bobs@sagehill.net>
Sat, 2 Jun 2012 20:14:04 +0000 (20:14 +0000)
xsl/xhtml5/html5-chunk-mods.xsl
xsl/xhtml5/html5-element-mods.xsl

index 746fc2ba1eb7e55695f863c6b7475ae5cb848d6d..27426ac1ac7e86c2d55c87a802adba9baf506e3c 100644 (file)
@@ -8,446 +8,7 @@
 
 <!-- $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 -->
+<!-- call HTML5  header and footer templates for navigation -->
 <xsl:template name="chunk-element-content">
   <xsl:param name="prev"/>
   <xsl:param name="next"/>
 
     <body>
       <xsl:call-template name="body.attributes"/>
-      <xsl:call-template name="user.header.navigation"/>
 
-      <xsl:call-template name="header.navigation">
+      <xsl:call-template name="html5.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 name="user.footer.content"/>
 
-      <xsl:call-template name="footer.navigation">
+      <xsl:call-template name="html5.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>
 
+<!-- Add HTML5 <header>  wrapper, and convert some attributes to styles -->
+<xsl:template name="html5.header.navigation">
+  <xsl:param name="prev" select="/foo"/>
+  <xsl:param name="next" select="/foo"/>
+  <xsl:param name="nav.context"/>
+
+  <xsl:variable name="content">
+    <header>
+      <xsl:call-template name="user.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="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>
+    </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:template>
+
+<!-- Add HTML5 <footer>  wrapper, and convert some attributes to styles -->
+<xsl:template name="html5.footer.navigation">
+  <xsl:param name="prev" select="/foo"/>
+  <xsl:param name="next" select="/foo"/>
+  <xsl:param name="nav.context"/>
+
+  <xsl:variable name="content">
+    <footer>
+      <xsl:call-template name="user.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="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>
+    </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:template>
 
 </xsl:stylesheet>
index 9636f20d5e7411f50d40f2d458bcf13b78813d3b..9aae285fc72b7dfc305f46ac516822712d927c48 100644 (file)
 <xsl:param name="css.decoration" select="1"/>
 <xsl:param name="make.clean.html" select="1"/>
 <xsl:param name="generate.id.attributes" select="1"/>
+<xsl:variable name="div.element">section</xsl:variable>
 
 <!--==============================================================-->
 <!--  Customized templates                                        -->
 <!--==============================================================-->
 
+<!-- HTML5: needs special doctype -->
+<xsl:template name="user.preroot">
+  <xsl:text disable-output-escaping="yes">&lt;!DOCTYPE html&gt;</xsl:text>
+</xsl:template>
+
 <!-- HTML5: Replace HTML acronum with abbr for HTML 5 -->
 <xsl:template match="acronym">
   <xsl:call-template name="inline.charseq">
     <xsl:value-of select="concat($style.from.atts, @style)"/>
   </xsl:variable>
 
-  <!-- HTML5: <th> does not support block elements, use <td> -->
+  <!-- HTML5: reserved for element name conversion if needed -->
   <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:value-of select="local-name(.)"/>
   </xsl:variable>
 
   <xsl:element name="{$element.name}">
   <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>
-
-<!-- Remove table summary and set border="" -->
-
-<xsl:template match="segmentedlist" mode="seglist-table">
-  <xsl:variable name="table-summary">
-    <xsl:call-template name="pi.dbhtml_table-summary"/>
-  </xsl:variable>
-
-  <xsl:variable name="list-width">
-    <xsl:call-template name="pi.dbhtml_list-width"/>
-  </xsl:variable>
-
-  <xsl:apply-templates select="title"/>
-
-  <table border="">
-    <xsl:if test="$list-width != ''">
-      <xsl:attribute name="width">
-        <xsl:value-of select="$list-width"/>
-      </xsl:attribute>
-    </xsl:if>
-    <!--
-    <xsl:if test="$table-summary != ''">
-      <xsl:attribute name="summary">
-        <xsl:value-of select="$table-summary"/>
-      </xsl:attribute>
-    </xsl:if>
-    -->
-    <thead>
-      <tr class="segtitle">
-        <xsl:call-template name="tr.attributes">
-          <xsl:with-param name="row" select="segtitle[1]"/>
-          <xsl:with-param name="rownum" select="1"/>
-        </xsl:call-template>
-        <xsl:apply-templates select="segtitle" mode="seglist-table"/>
-      </tr>
-    </thead>
-    <tbody>
-      <xsl:apply-templates select="seglistitem" mode="seglist-table"/>
-    </tbody>
-  </table>
-</xsl:template>
-
-<xsl:template name="graphical.admonition">
-  <xsl:variable name="admon.type">
-    <xsl:choose>
-      <xsl:when test="local-name(.)='note'">Note</xsl:when>
-      <xsl:when test="local-name(.)='warning'">Warning</xsl:when>
-      <xsl:when test="local-name(.)='caution'">Caution</xsl:when>
-      <xsl:when test="local-name(.)='tip'">Tip</xsl:when>
-      <xsl:when test="local-name(.)='important'">Important</xsl:when>
-      <xsl:otherwise>Note</xsl:otherwise>
-    </xsl:choose>
-  </xsl:variable>
-
-  <xsl:variable name="alt">
-    <xsl:call-template name="gentext">
-      <xsl:with-param name="key" select="$admon.type"/>
-    </xsl:call-template>
-  </xsl:variable>
-
-  <div>
-    <xsl:call-template name="common.html.attributes"/>
-    <xsl:if test="$admon.style != ''">
-      <xsl:attribute name="style">
-        <xsl:value-of select="$admon.style"/>
-      </xsl:attribute>
-    </xsl:if>
-
-    <xsl:variable name="content">
-      <table border="">
-        <tr>
-          <td rowspan="2" align="center" valign="top">
-            <xsl:attribute name="width">
-              <xsl:apply-templates select="." mode="admon.graphic.width"/>
-            </xsl:attribute>
-            <img alt="[{$alt}]">
-              <xsl:attribute name="src">
-                <xsl:call-template name="admon.graphic"/>
-              </xsl:attribute>
-            </img>
-          </td>
-          <th align="{$direction.align.start}">
-            <xsl:call-template name="anchor"/>
-            <xsl:if test="$admon.textlabel != 0 or title or info/title">
-              <xsl:apply-templates select="." mode="object.title.markup"/>
-            </xsl:if>
-          </th>
-        </tr>
-        <tr>
-          <td align="{$direction.align.start}" valign="top">
-            <xsl:apply-templates/>
-          </td>
-        </tr>
-      </table>
-    </xsl:variable>
-
-    <xsl:variable name="table.nodes" select="exsl:node-set($content)"/>
-
-    <xsl:apply-templates select="$table.nodes" mode="convert.to.style"/>
-  </div>
-</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">
-  <!-- Handle spacing="compact" as multiple class attribute instead
-       of the deprecated HTML compact attribute -->
-  <xsl:variable name="default.class">
-    <xsl:value-of select="local-name()"/>
-    <xsl:if test="@spacing = 'compact'">
-      <xsl:text> compact</xsl:text>
-    </xsl:if>
-  </xsl:variable>
-  
-  <div>
-    <xsl:call-template name="common.html.attributes"/>
-    <xsl:call-template name="id.attribute"/>
-    <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:with-param name="class" select="$default.class"/>
-      </xsl:call-template>
-
-      <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; text-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 match="note|important|warning|caution|tip">
+  <xsl:call-template name="convert.styles"/>
 </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:call-template name="id.attribute">
-      <xsl:with-param name="conditional" select="0"/>
-    </xsl:call-template>
-
-    <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 match="funcprototype" mode="ansi-tabular">
+  <xsl:call-template name="convert.styles"/>
 </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 match="funcprototype" mode="kr-tabular">
+  <xsl:call-template name="convert.styles"/>
 </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="id.attribute">
-      <xsl:with-param name="conditional" select="0"/>
-    </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:template name="convert.styles">
+  <xsl:param name="content">
+   <xsl:apply-imports/>
+  </xsl:param>
+  <xsl:variable name="nodes" select="exsl:node-set($content)"/>
 
-    <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:apply-templates mode="convert.to.style" select="$nodes"/>
 </xsl:template>
 
 <!-- HTML5: link rel="home" is not permitted -->
 <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: uses <ul> instead of <dl> for TOC -->
 <xsl:template match="question" mode="qandatoc.mode">
   <xsl:variable name="firstch">
   </li>
 </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">
   </div> 
 </xsl:template>
 
-<!-- HTML5: select videoobject and audioobject before textobject -->
-<xsl:template name="select.mediaobject.index">
-  <xsl:param name="olist"
-             select="imageobject|imageobjectco
-                     |videoobject|audioobject|textobject"/>
-  <xsl:param name="count">1</xsl:param>
-
-  <xsl:choose>
-    <!-- Test for objects preferred by role -->
-    <xsl:when test="$use.role.for.mediaobject != 0 
-               and $preferred.mediaobject.role != ''
-               and $olist[@role = $preferred.mediaobject.role]"> 
-      
-      <!-- Get the first hit's position index -->
-      <xsl:for-each select="$olist">
-        <xsl:if test="@role = $preferred.mediaobject.role and
-             not(preceding-sibling::*[@role = $preferred.mediaobject.role])"> 
-          <xsl:value-of select="position()"/> 
-        </xsl:if>
-      </xsl:for-each>
-    </xsl:when>
-
-    <xsl:when test="$use.role.for.mediaobject != 0 
-               and $olist[@role = $stylesheet.result.type]">
-      <!-- Get the first hit's position index -->
-      <xsl:for-each select="$olist">
-        <xsl:if test="@role = $stylesheet.result.type and 
-              not(preceding-sibling::*[@role = $stylesheet.result.type])"> 
-          <xsl:value-of select="position()"/> 
-        </xsl:if>
-      </xsl:for-each>
-    </xsl:when>
-    <!-- Accept 'html' for $stylesheet.result.type = 'xhtml' -->
-    <xsl:when test="$use.role.for.mediaobject != 0 
-               and $stylesheet.result.type = 'xhtml'
-               and $olist[@role = 'html']">
-      <!-- Get the first hit's position index -->
-      <xsl:for-each select="$olist">
-        <xsl:if test="@role = 'html' and 
-              not(preceding-sibling::*[@role = 'html'])"> 
-          <xsl:value-of select="position()"/> 
-        </xsl:if>
-      </xsl:for-each>
-    </xsl:when>
-
-    <!-- If no selection by role, and there is only one object, use it -->
-    <xsl:when test="count($olist) = 1 and $count = 1">
-      <xsl:value-of select="$count"/> 
-    </xsl:when>
-
-    <xsl:otherwise>
-      <!-- Otherwise select first acceptable object -->
-      <xsl:if test="$count &lt;= count($olist)">
-        <xsl:variable name="object" select="$olist[position()=$count]"/>
-    
-        <xsl:variable name="useobject">
-          <xsl:choose>
-            <!-- select videoobject or audioobject before textobject -->
-            <xsl:when test="local-name($object) = 'videoobject'">
-              <xsl:text>1</xsl:text> 
-            </xsl:when>
-            <xsl:when test="local-name($object) = 'audioobject'">
-              <xsl:text>1</xsl:text> 
-            </xsl:when>
-            <!-- skip textobject if also video, audio, or image out of order -->
-            <xsl:when test="local-name($object) = 'textobject' and
-                            ../imageobject or
-                            ../audioobject or
-                            ../videoobject">
-              <xsl:text>0</xsl:text> 
-            </xsl:when>
-            <!-- The phrase is used only when contains TeX Math and output is FO -->
-            <xsl:when test="local-name($object)='textobject' and $object/phrase
-                            and $object/@role='tex' and $stylesheet.result.type = 'fo'
-                            and $tex.math.in.alt != ''">
-              <xsl:text>1</xsl:text> 
-            </xsl:when>
-            <!-- The phrase is never used -->
-            <xsl:when test="local-name($object)='textobject' and $object/phrase">
-              <xsl:text>0</xsl:text>
-            </xsl:when>
-            <xsl:when test="local-name($object)='textobject'
-                            and $object/ancestor::equation ">
-            <!-- The first textobject is not a reasonable fallback
-                 for equation image -->
-              <xsl:text>0</xsl:text>
-            </xsl:when>
-            <!-- The first textobject is a reasonable fallback -->
-            <xsl:when test="local-name($object)='textobject'
-                            and $object[not(@role) or @role!='tex']">
-              <xsl:text>1</xsl:text>
-            </xsl:when>
-            <!-- don't use graphic when output is FO, TeX Math is used 
-                 and there is math in alt element -->
-            <xsl:when test="$object/ancestor::equation and 
-                            $object/ancestor::equation/alt[@role='tex']
-                            and $stylesheet.result.type = 'fo'
-                            and $tex.math.in.alt != ''">
-              <xsl:text>0</xsl:text>
-            </xsl:when>
-            <!-- If there's only one object, use it -->
-            <xsl:when test="$count = 1 and count($olist) = 1">
-               <xsl:text>1</xsl:text>
-            </xsl:when>
-            <!-- Otherwise, see if this one is a useable graphic -->
-            <xsl:otherwise>
-              <xsl:choose>
-                <!-- peek inside imageobjectco to simplify the test -->
-                <xsl:when test="local-name($object) = 'imageobjectco'">
-                  <xsl:call-template name="is.acceptable.mediaobject">
-                    <xsl:with-param name="object" select="$object/imageobject"/>
-                  </xsl:call-template>
-                </xsl:when>
-                <xsl:otherwise>
-                  <xsl:call-template name="is.acceptable.mediaobject">
-                    <xsl:with-param name="object" select="$object"/>
-                  </xsl:call-template>
-                </xsl:otherwise>
-              </xsl:choose>
-            </xsl:otherwise>
-          </xsl:choose>
-        </xsl:variable>
-    
-        <xsl:choose>
-          <xsl:when test="$useobject='1'">
-            <xsl:value-of select="$count"/>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:call-template name="select.mediaobject.index">
-              <xsl:with-param name="olist" select="$olist"/>
-              <xsl:with-param name="count" select="$count + 1"/>
-            </xsl:call-template>
-          </xsl:otherwise>
-        </xsl:choose>
-      </xsl:if>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
 <!-- HTML5: no body attributes -->
 <xsl:template name="body.attributes"/>