[yelp-xsl] Improve xsl-doc output



commit c39af87bc93cd0218003256f909add79c8fe056a
Author: Shaun McCance <shaunm gnome org>
Date:   Tue May 25 09:36:49 2010 -0500

    Improve xsl-doc output

 doc/yelp-xsl/xsldoc-scan.xsl        |   17 +
 xslt/common/Makefile.am             |    4 +-
 xslt/common/html.xsl                |  721 +++++++++++++++++++++++++++++++++++
 xslt/mallard/common/Makefile.am     |    2 +-
 xslt/mallard/common/mal-chunk.xsl   |   92 -----
 xslt/mallard/common/mal-link.xsl    |   15 +-
 xslt/mallard/html/mal2html-css.xsl  |  131 +------
 xslt/mallard/html/mal2html-list.xsl |    2 +-
 xslt/mallard/html/mal2html-page.xsl |  339 +++++++----------
 xslt/mallard/html/mal2html.xsl      |   49 +---
 xslt/mallard/html/mal2xhtml.xsl     |   44 +--
 11 files changed, 926 insertions(+), 490 deletions(-)
---
diff --git a/doc/yelp-xsl/xsldoc-scan.xsl b/doc/yelp-xsl/xsldoc-scan.xsl
index c42ed38..2b9e263 100644
--- a/doc/yelp-xsl/xsldoc-scan.xsl
+++ b/doc/yelp-xsl/xsldoc-scan.xsl
@@ -61,6 +61,23 @@ free software.
         <xsl:copy-of select="mal:desc"/>
       </xsl:if>
       <xsl:copy-of select="mal:info/*[not(self::mal:desc)]"/>
+      <!-- xslt-includes -->
+      <xsl:for-each select="$xslt_file//xsl:include">
+        <xsl:choose>
+          <xsl:when test="processing-instruction('pass')">
+            <xsl:for-each select="document(@href, /)//xsl:include">
+              <xsl:variable name="id" select="translate(substring-before(str:split(@href, '/')[last()],
+                                              '.xsl'), '.', '_')"/>
+              <link type="topic" xref="{$id}"/>
+            </xsl:for-each>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:variable name="id" select="translate(substring-before(str:split(@href, '/')[last()],
+                                            '.xsl'), '.', '_')"/>
+            <link type="topic" xref="{$id}"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:for-each>
       <!-- xslt-calls-template -->
       <xsl:for-each select="set:distinct($xslt_file//xsl:call-template/@name)">
         <xsl:variable name="name" select="string(.)"/>
diff --git a/xslt/common/Makefile.am b/xslt/common/Makefile.am
index 7811c70..9c999b4 100644
--- a/xslt/common/Makefile.am
+++ b/xslt/common/Makefile.am
@@ -1,6 +1,8 @@
 xsldir=$(datadir)/yelp-xsl/xslt/common
 
-xsl_DATA = utils.xsl
+xsl_DATA =		\
+	html.xsl	\
+	utils.xsl
 
 EXTRA_DIST=$(xsl_DATA)
 
diff --git a/xslt/common/html.xsl b/xslt/common/html.xsl
new file mode 100644
index 0000000..c87b7fb
--- /dev/null
+++ b/xslt/common/html.xsl
@@ -0,0 +1,721 @@
+<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
+<!--
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free
+Software Foundation; either version 2 of the License, or (at your option) any
+later version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; see the file COPYING.LGPL.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+                xmlns:html="http://www.w3.org/1999/xhtml";
+                xmlns:exsl="http://exslt.org/common";
+                xmlns="http://www.w3.org/1999/xhtml";
+                exclude-result-prefixes="html"
+                extension-element-prefixes="exsl"
+                version="1.0">
+
+<!--!!==========================================================================
+Common HTML Utilities
+Output CSS for transformations to HTML.
+:Requires: gettext colors icons
+
+FIXME
+-->
+
+<xsl:param name="html.basename">
+  <xsl:choose>
+    <xsl:when test="/*/@xml:id">
+      <xsl:value-of select="/*/@xml:id"/>
+    </xsl:when>
+    <xsl:when test="/*/@id">
+      <xsl:value-of select="/*/@id"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:text>index</xsl:text>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+
+<xsl:param name="html.html5" select="false()"/>
+<xsl:param name="html.xhtml" select="true()"/>
+
+<xsl:param name="html.namespace">
+  <xsl:choose>
+    <xsl:when test="$html.xhtml">
+      <xsl:value-of select="'http://www.w3.org/1999/xhtml'"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:text></xsl:text>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+
+<xsl:param name="html.extension">
+  <xsl:choose>
+    <xsl:when test="$html.namespace = ''">
+      <xsl:text>.html</xsl:text>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:text>.xhtml</xsl:text>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+
+<xsl:template name="html.output">
+  <xsl:param name="node" select="."/>
+  <xsl:param name="href">
+    <xsl:choose>
+      <xsl:when test="$node/@xml:id">
+        <xsl:value-of select="concat($node/@xml:id, $html.extension)"/>
+      </xsl:when>
+      <xsl:when test="$node/@id">
+        <xsl:value-of select="concat($node/@id, $html.extension)"/>
+      </xsl:when>
+      <xsl:when test="exsl:has-same-node($node, /*)">
+        <xsl:value-of select="concat($html.basename, $html.extension)"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="concat(generate-id(), $html.extension)"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:param>
+  <exsl:document href="{$href}">
+    <xsl:choose>
+      <xsl:when test="$html.html5">
+        <xsl:call-template name="html.page">
+          <xsl:with-param name="node" select="$node"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="contents">
+          <xsl:call-template name="html.page">
+            <xsl:with-param name="node" select="$node"/>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:apply-templates mode="html.compat.mode" select="exsl:node-set($contents)/*"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </exsl:document>
+</xsl:template>
+
+<xsl:template name="html.page">
+  <xsl:param name="node" select="."/>
+  <html>
+    <head>
+      <title>
+        <xsl:apply-templates mode="html.title.mode" select="$node"/>
+      </title>
+      <xsl:call-template name="html.css"/>
+      <xsl:call-template name="html.head.custom"/>
+    </head>
+    <body>
+      <header>
+        <xsl:apply-templates mode="html.header.mode" select="$node"/>
+      </header>
+      <article>
+        <xsl:apply-templates mode="html.body.mode" select="$node"/>
+      </article>
+      <footer>
+        <xsl:apply-templates mode="html.footer.mode" select="$node"/>
+      </footer>
+    </body>
+  </html>
+</xsl:template>
+
+<xsl:template mode="html.page.mode" match="*"/>
+
+<xsl:template name="html.head.custom">
+  <xsl:param name="node" select="."/>
+</xsl:template>
+
+<xsl:template name="html.css">
+  <xsl:param name="node" select="."/>
+  <xsl:param name="direction">
+    <xsl:call-template name="l10n.direction"/>
+  </xsl:param>
+  <xsl:param name="left">
+    <xsl:call-template name="l10n.align.start">
+      <xsl:with-param name="direction" select="$direction"/>
+    </xsl:call-template>
+  </xsl:param>
+  <xsl:param name="right">
+    <xsl:call-template name="l10n.align.end">
+      <xsl:with-param name="direction" select="$direction"/>
+    </xsl:call-template>
+  </xsl:param>
+  <style type="text/css">
+    <xsl:call-template name="html.css.core">
+      <xsl:with-param name="direction" select="$direction"/>
+      <xsl:with-param name="left" select="$left"/>
+      <xsl:with-param name="right" select="$right"/>
+    </xsl:call-template>
+    <xsl:call-template name="html.css.elements">
+      <xsl:with-param name="direction" select="$direction"/>
+      <xsl:with-param name="left" select="$left"/>
+      <xsl:with-param name="right" select="$right"/>
+    </xsl:call-template>
+    <xsl:apply-templates mode="html.css.mode" select="$node">
+      <xsl:with-param name="direction" select="$direction"/>
+      <xsl:with-param name="left" select="$left"/>
+      <xsl:with-param name="right" select="$right"/>
+    </xsl:apply-templates>
+    <xsl:call-template name="html.css.custom">
+      <xsl:with-param name="direction" select="$direction"/>
+      <xsl:with-param name="left" select="$left"/>
+      <xsl:with-param name="right" select="$right"/>
+    </xsl:call-template>
+  </style>
+</xsl:template>
+
+<xsl:template name="html.css.core">
+  <xsl:param name="direction">
+    <xsl:call-template name="l10n.direction"/>
+  </xsl:param>
+  <xsl:param name="left">
+    <xsl:call-template name="l10n.align.start">
+      <xsl:with-param name="direction" select="$direction"/>
+    </xsl:call-template>
+  </xsl:param>
+  <xsl:param name="right">
+    <xsl:call-template name="l10n.align.end">
+      <xsl:with-param name="direction" select="$direction"/>
+    </xsl:call-template>
+  </xsl:param>
+  <xsl:variable name="header">
+    <xsl:choose>
+      <xsl:when test="$html.html5">
+        <xsl:text>header</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>div.header</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <xsl:variable name="footer">
+    <xsl:choose>
+      <xsl:when test="$html.html5">
+        <xsl:text>footer</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>div.footer</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <xsl:variable name="article">
+    <xsl:choose>
+      <xsl:when test="$html.html5">
+        <xsl:text>article</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>div.body</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <xsl:variable name="section">
+    <xsl:choose>
+      <xsl:when test="$html.html5">
+        <xsl:text>section</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>div.sect</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <xsl:variable name="hgroup">
+    <xsl:choose>
+      <xsl:when test="$html.html5">
+        <xsl:text>hgroup</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>div.hgroup</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <xsl:text>
+html { height: 100%; }
+body {
+  margin: 0;
+  padding-top: 1em;
+  padding-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 1em;
+  background-color: </xsl:text>
+    <xsl:value-of select="$theme.color.gray_background"/><xsl:text>;
+  color: </xsl:text>
+    <xsl:value-of select="$theme.color.text"/><xsl:text>;
+  direction: </xsl:text><xsl:value-of select="$direction"/><xsl:text>;
+  max-width: 73em;
+  position: relative;
+}
+</xsl:text><xsl:value-of select="$article"/><xsl:text> {
+  margin: 0;
+  padding: 1em;
+  max-width: 60em;
+  min-height: 20em;
+  background-color: </xsl:text>
+    <xsl:value-of select="$theme.color.background"/><xsl:text>;
+  border: solid 1px </xsl:text>
+    <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
+}
+</xsl:text><xsl:value-of select="$header"/><xsl:text> {
+  max-width: 60em;
+}
+</xsl:text><xsl:value-of select="$footer"/><xsl:text> {
+  max-width: 60em;
+}
+</xsl:text><xsl:value-of select="$section"/><xsl:text> {
+  margin-top: 1.72em;
+  clear: both;
+}
+</xsl:text><xsl:value-of select="concat($section, ' ', $section)"/><xsl:text>
+  margin-top: 1.44em;
+  margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 1.72em;
+}
+div.trails { margin: 0; }
+div.trail {
+  font-size: 0.83em;
+  margin: 0 2.2em 0.2em 2.2em;
+  padding: 0;
+  text-indent: -1em;
+  color: </xsl:text>
+    <xsl:value-of select="$theme.color.text_light"/><xsl:text>;
+}
+a.trail { white-space: nowrap; }
+</xsl:text><xsl:value-of select="$hgroup"/><xsl:text> {
+  margin: 0 0 0.5em 0;
+  color: </xsl:text>
+    <xsl:value-of select="$theme.color.text_light"/><xsl:text>;
+  border-bottom: solid 1px </xsl:text>
+    <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
+}
+h1, h2, h3, h4, h5, h6, h7 {
+  margin: 0; padding: 0;
+  color: </xsl:text><xsl:value-of select="$theme.color.text_light"/><xsl:text>;
+  font-weight: bold;
+}
+</xsl:text>
+<xsl:choose>
+<xsl:when test="$html.html5">
+<xsl:text>
+h1.title { font-size: 1.44em; }
+h2.subtitle { font-size: 1.2em; }
+section h1.title { font-size: 1.2em; }
+section h2.subtitle { font-size: 1.0em; }
+</xsl:text>
+</xsl:when>
+<xsl:otherwise>
+<xsl:text>
+h1 { font-size: 1.44em; }
+h2 { font-size: 1.2em; }
+h3.title, h4.title, h5.title, h6.title, h7.title { font-size: 1.2em; }
+h3, h4, h5, h6, h7 { font-size: 1em; }
+</xsl:text>
+</xsl:otherwise>
+</xsl:choose>
+<xsl:text>
+p { line-height: 1.72em; }
+div, pre, p { margin: 1em 0 0 0; padding: 0; }
+div:first-child, pre:first-child, p:first-child { margin-top: 0; }
+div.inner, div.contents, pre.contents { margin-top: 0; }
+p img { vertical-align: middle; }
+
+table {
+  border-collapse: collapse;
+  border-color: </xsl:text><xsl:value-of select="$theme.color.text_light"/><xsl:text>;
+  border-width: 1px;
+}
+td, th {
+  padding: 0.5em;
+  vertical-align: top;
+  border-color: </xsl:text><xsl:value-of select="$theme.color.text_light"/><xsl:text>;
+  border-width: 1px;
+}
+thead td, thead th, tfoot td, tfoot th {
+  padding: 0.2em 0.5em 0.2em 0.5em;
+}
+
+ul, ol, dl { margin: 0; padding: 0; }
+li {
+  margin: 1em 0 0 0;
+  margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 2.4em;
+  padding: 0;
+}
+li:first-child { margin-top: 0; }
+dt { margin-top: 1em; }
+dt:first-child { margin-top: 0; }
+dt + dt { margin-top: 0; }
+dd {
+  margin: 0.2em 0 0 0;
+  margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 1.44em;
+}
+ol.compact li { margin-top: 0.2em; }
+ul.compact li { margin-top: 0.2em; }
+ol.compact li:first-child { margin-top: 0; }
+ul.compact li:first-child { margin-top: 0; }
+dl.compact dt { margin-top: 0.2em; }
+dl.compact dt:first-child { margin-top: 0; }
+dl.compact dt + dt { margin-top: 0; }
+
+a {
+  text-decoration: none;
+  color: </xsl:text><xsl:value-of select="$theme.color.link"/><xsl:text>;
+}
+a:visited { color: </xsl:text>
+  <xsl:value-of select="$theme.color.link_visited"/><xsl:text>; }
+a:hover { text-decoration: underline; }
+a img { border: none; }
+</xsl:text>
+</xsl:template>
+
+
+<!--**==========================================================================
+html.css.elements
+Output CSS for common elements from source formats.
+$direction: The directionality of the text, either #{ltr} or #{rtl}.
+$left: The starting alignment, either #{left} or #{right}.
+$right: The ending alignment, either #{left} or #{right}.
+
+This template outputs CSS for elements from source languages like DocBook and
+Mallard.  It defines them using common class names.  The common names are often
+the simpler element names from Mallard, although there some class names which
+are not taken from Mallard.  Stylesheets which convert to HTML should use the
+appropriate common classes.
+
+All parameters can be automatically computed if not provided.
+-->
+<xsl:template name="html.css.elements">
+  <xsl:param name="direction">
+    <xsl:call-template name="l10n.direction"/>
+  </xsl:param>
+  <xsl:param name="left">
+    <xsl:call-template name="l10n.align.start">
+      <xsl:with-param name="direction" select="$direction"/>
+    </xsl:call-template>
+  </xsl:param>
+  <xsl:param name="right">
+    <xsl:call-template name="l10n.align.end">
+      <xsl:with-param name="direction" select="$direction"/>
+    </xsl:call-template>
+  </xsl:param>
+  <xsl:text>
+div.title {
+  margin: 0 0 0.2em 0;
+  font-weight: bold;
+  color: </xsl:text><xsl:value-of select="$theme.color.text_light"/><xsl:text>;
+}
+div.desc { margin: 0 0 0.2em 0; }
+div.contents + div.desc { margin: 0.2em 0 0 0; }
+pre.contents {
+  padding: 0.5em 1em 0.5em 1em;
+}
+pre.linenumbering {
+  margin: 0;
+  padding: 0.5em;
+  float: </xsl:text><xsl:value-of select="$left"/><xsl:text>;
+  margin-</xsl:text><xsl:value-of select="$right"/><xsl:text>: 0.5em;
+  text-align: </xsl:text><xsl:value-of select="$right"/><xsl:text>;
+  color: </xsl:text><xsl:value-of select="$theme.color.text_light"/><xsl:text>;
+  background-color: </xsl:text>
+    <xsl:value-of select="$theme.color.yellow_background"/><xsl:text>;
+}
+div.code {
+  background: url('</xsl:text>
+    <xsl:value-of select="$theme.icons.code"/><xsl:text>') no-repeat top </xsl:text>
+    <xsl:value-of select="$right"/><xsl:text>;
+  border: solid 1px </xsl:text>
+    <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
+}
+div.figure {
+  margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 1.72em;
+  padding: 4px;
+  color: </xsl:text>
+    <xsl:value-of select="$theme.color.text_light"/><xsl:text>;
+  border: solid 1px </xsl:text>
+    <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
+  background-color: </xsl:text>
+    <xsl:value-of select="$theme.color.gray_background"/><xsl:text>;
+}
+div.figure > div.inner > div.contents {
+  margin: 0;
+  padding: 0.5em 1em 0.5em 1em;
+  text-align: center;
+  color: </xsl:text>
+    <xsl:value-of select="$theme.color.text"/><xsl:text>;
+  border: solid 1px </xsl:text>
+    <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
+  background-color: </xsl:text>
+    <xsl:value-of select="$theme.color.background"/><xsl:text>;
+}
+div.list > div.title { margin-bottom: 0.5em; }
+div.listing > div.inner { margin: 0; padding: 0; }
+div.listing > div.inner > div.desc { font-style: italic; }
+div.note {
+  padding: 6px;
+  border-top: solid 1px </xsl:text>
+    <xsl:value-of select="$theme.color.red_border"/><xsl:text>;
+  border-bottom: solid 1px </xsl:text>
+    <xsl:value-of select="$theme.color.red_border"/><xsl:text>;
+  background-color: </xsl:text>
+    <xsl:value-of select="$theme.color.yellow_background"/><xsl:text>;
+}
+div.note > div.inner > div.title {
+  margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: </xsl:text>
+    <xsl:value-of select="$theme.icons.size.note + 6"/><xsl:text>px;
+}
+div.note > div.inner > div.contents {
+  margin: 0; padding: 0;
+  margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: </xsl:text>
+    <xsl:value-of select="$theme.icons.size.note + 6"/><xsl:text>px;
+}
+div.note > div.inner {
+  margin: 0; padding: 0;
+  background-image: url("</xsl:text>
+    <xsl:value-of select="$theme.icons.note"/><xsl:text>");
+  background-position: </xsl:text><xsl:value-of select="$left"/><xsl:text> top;
+  background-repeat: no-repeat;
+  min-height: </xsl:text><xsl:value-of select="$theme.icons.size.note"/><xsl:text>px;
+}
+div.note-advanced div.inner { <!-- background-image: url("</xsl:text>
+  <xsl:value-of select="$theme.icons.note.advanced"/><xsl:text>"); --> }
+div.note-bug div.inner { background-image: url("</xsl:text>
+  <xsl:value-of select="$theme.icons.note.bug"/><xsl:text>"); }
+div.note-important div.inner { background-image: url("</xsl:text>
+  <xsl:value-of select="$theme.icons.note.important"/><xsl:text>"); }
+div.note-tip div.inner { background-image: url("</xsl:text>
+  <xsl:value-of select="$theme.icons.note.tip"/><xsl:text>"); }
+div.note-warning div.inner { background-image: url("</xsl:text>
+  <xsl:value-of select="$theme.icons.note.warning"/><xsl:text>"); }
+div.quote {
+  padding: 0;
+  background-image: url('</xsl:text>
+    <xsl:value-of select="$theme.icons.quote"/><xsl:text>');
+  background-repeat: no-repeat;
+  background-position: top </xsl:text><xsl:value-of select="$left"/><xsl:text>;
+  min-height: </xsl:text>
+    <xsl:value-of select="$theme.icons.size.quote"/><xsl:text>px;
+}
+div.quote > div.inner > div.title {
+  margin: 0 0 0.5em 0;
+  margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: </xsl:text>
+    <xsl:value-of select="$theme.icons.size.quote"/><xsl:text>px;
+}
+blockquote {
+  margin: 0; padding: 0;
+  margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: </xsl:text>
+    <xsl:value-of select="$theme.icons.size.quote"/><xsl:text>px;
+}
+div.quote > div.inner > div.cite {
+  margin-top: 0.5em;
+  margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: </xsl:text>
+    <xsl:value-of select="$theme.icons.size.quote"/><xsl:text>px;
+  color: </xsl:text><xsl:value-of select="$theme.color.text_light"/><xsl:text>;
+}
+div.quote > div.inner > div.cite::before {
+  <!-- FIXME: i18n -->
+  content: '&#x2015; ';
+}
+div.screen {
+  background-color: </xsl:text>
+    <xsl:value-of select="$theme.color.gray_background"/><xsl:text>;
+  border: solid 1px </xsl:text>
+    <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
+}
+ol.steps, ul.steps {
+  margin: 0;
+  padding: 0.5em 1em 0.5em 1em;
+  border-top: solid 1px;
+  border-bottom: solid 1px;
+  border-color: </xsl:text>
+    <xsl:value-of select="$theme.color.blue_border"/><xsl:text>;
+  background-color: </xsl:text>
+    <xsl:value-of select="$theme.color.yellow_background"/><xsl:text>;
+}
+ol.steps .steps {
+  padding: 0;
+  border: none;
+  background-color: none;
+}
+li.steps { margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 1.44em; }
+li.steps li.steps { margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 2.4em; }
+div.synopsis > div.inner > div.contents, div.synopsis > pre.contents {
+  padding: 0.5em 1em 0.5em 1em;
+  border-top: solid 1px;
+  border-bottom: solid 1px;
+  border-color: </xsl:text>
+    <xsl:value-of select="$theme.color.blue_border"/><xsl:text>;
+  background-color: </xsl:text>
+    <xsl:value-of select="$theme.color.gray_background"/><xsl:text>;
+}
+div.synopsis > div.inner > div.desc { font-style: italic; }
+div.synopsis div.code {
+  background: none;
+  border: none;
+  padding: 0;
+}
+div.synopsis div.code > pre.contents { margin: 0; padding: 0; }
+.table {}
+tr.shade {
+  background-color: </xsl:text><xsl:value-of select="$theme.color.gray_background"/><xsl:text>;
+}
+td.shade {
+  background-color: </xsl:text><xsl:value-of select="$theme.color.gray_background"/><xsl:text>;
+}
+tr.shade td.shade {
+  background-color: </xsl:text><xsl:value-of select="$theme.color.dark_background"/><xsl:text>;
+}
+
+span.app { font-style: italic; }
+span.cmd {
+  font-family: monospace;
+  background-color: </xsl:text>
+    <xsl:value-of select="$theme.color.gray_background"/><xsl:text>;
+  padding: 0 0.2em 0 0.2em;
+}
+span.cmd span.cmd { background-color: none; padding: 0; }
+pre span.cmd { background-color: none; padding: 0; }
+span.code {
+  font-family: monospace;
+  border-bottom: solid 1px </xsl:text><xsl:value-of select="$theme.color.dark_background"/><xsl:text>;
+}
+span.code span.code { border: none; }
+pre span.code { border: none; }
+span.em { font-style: italic; }
+span.em-bold {
+  font-style: normal; font-weight: bold;
+  color: </xsl:text><xsl:value-of select="$theme.color.text_light"/><xsl:text>;
+}
+pre span.error {
+  color: </xsl:text><xsl:value-of select="$theme.color.text_error"/><xsl:text>;
+}
+span.file { font-family: monospace; }
+span.gui, span.guiseq { color: </xsl:text>
+  <xsl:value-of select="$theme.color.text_light"/><xsl:text>; }
+span.input { font-family: monospace; }
+pre span.input {
+  font-weight: bold;
+  color: </xsl:text><xsl:value-of select="$theme.color.text_light"/><xsl:text>;
+}
+span.key {
+  color: </xsl:text>
+    <xsl:value-of select="$theme.color.text_light"/><xsl:text>;
+  border: solid 1px </xsl:text>
+    <xsl:value-of select="$theme.color.yellow_border"/><xsl:text>;
+  padding: 0 0.2em 0 0.2em;
+}
+span.keyseq {
+  color: </xsl:text>
+    <xsl:value-of select="$theme.color.text_light"/><xsl:text>;
+}
+span.output { font-family: monospace; }
+pre span.output {
+  color: </xsl:text><xsl:value-of select="$theme.color.text"/><xsl:text>;
+}
+pre span.prompt {
+  color: </xsl:text><xsl:value-of select="$theme.color.text_light"/><xsl:text>;
+}
+span.sys { font-family: monospace; }
+span.var { font-style: italic; }
+</xsl:text>
+</xsl:template>
+
+
+<!--**==========================================================================
+html.css.custom
+Stub to output custom CSS common to all HTML transformations.
+:Stub: true
+$direction: The directionality of the text, either #{ltr} or #{rtl}.
+$left: The starting alignment, either #{left} or #{right}.
+$right: The ending alignment, either #{left} or #{right}.
+
+This template is a stub, called by *{html.css}.  You can override this
+template to provide additional CSS that will be used by all HTML output.
+-->
+<xsl:template name="html.css.custom">
+  <xsl:param name="direction">
+    <xsl:call-template name="l10n.direction"/>
+  </xsl:param>
+  <xsl:param name="left">
+    <xsl:call-template name="l10n.align.start">
+      <xsl:with-param name="direction" select="$direction"/>
+    </xsl:call-template>
+  </xsl:param>
+  <xsl:param name="right">
+    <xsl:call-template name="l10n.align.end">
+      <xsl:with-param name="direction" select="$direction"/>
+    </xsl:call-template>
+  </xsl:param>
+</xsl:template>
+
+<!-- == html.compat.mode == -->
+
+<xsl:template mode="html.compat.mode" match="article | html:article">
+  <div class="body">
+    <xsl:copy-of select="@*[local-name(.) != 'class']"/>
+    <xsl:apply-templates mode="html.compat.mode" select="node()"/>
+  </div>
+</xsl:template>
+
+<xsl:template mode="html.compat.mode" match="header | html:header">
+  <div class="header">
+    <xsl:copy-of select="@*[local-name(.) != 'class']"/>
+    <xsl:apply-templates mode="html.compat.mode" select="node()"/>
+  </div>
+</xsl:template>
+
+<xsl:template mode="html.compat.mode" match="section | html:section">
+  <div class="sect">
+    <xsl:copy-of select="@*[local-name(.) != 'class']"/>
+    <xsl:apply-templates mode="html.compat.mode" select="node()"/>
+  </div>
+</xsl:template>
+
+<xsl:template mode="html.compat.mode" match="footer | html:footer">
+  <div class="footer">
+    <xsl:copy-of select="@*[local-name(.) != 'class']"/>
+    <xsl:apply-templates mode="html.compat.mode" select="node()"/>
+  </div>
+</xsl:template>
+
+<xsl:template mode="html.compat.mode" match="hgroup | html:hgroup">
+  <div class="hgroup">
+    <xsl:copy-of select="@*[local-name(.) != 'class']"/>
+    <xsl:apply-templates mode="html.compat.mode" select="node()"/>
+  </div>
+</xsl:template>
+
+<xsl:template mode="html.compat.mode" match="h1 | html:h1">
+  <xsl:variable name="depth">
+    <xsl:value-of select="count(ancestor::section | ancestor::html:section)"/>
+  </xsl:variable>
+  <xsl:element name="h{$depth + 1}" namespace="{$html.namespace}">
+    <xsl:copy-of select="@*"/>
+    <xsl:apply-templates mode="html.compat.mode" select="node()"/>
+  </xsl:element>
+</xsl:template>
+
+<xsl:template mode="html.compat.mode" match="h2 | html:h2">
+  <xsl:variable name="depth">
+    <xsl:value-of select="count(ancestor::section | ancestor::html:section)"/>
+  </xsl:variable>
+  <xsl:element name="h{$depth + 2}" namespace="{$html.namespace}">
+    <xsl:copy-of select="@*"/>
+    <xsl:apply-templates mode="html.compat.mode" select="node()"/>
+  </xsl:element>
+</xsl:template>
+
+<xsl:template mode="html.compat.mode" match="*">
+  <xsl:copy>
+    <xsl:copy-of select="@*"/>
+    <xsl:apply-templates mode="html.compat.mode" select="node()"/>
+  </xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/mallard/common/Makefile.am b/xslt/mallard/common/Makefile.am
index 06cfdc2..af7b415 100644
--- a/xslt/mallard/common/Makefile.am
+++ b/xslt/mallard/common/Makefile.am
@@ -1,5 +1,5 @@
 xsldir=$(datadir)/yelp-xsl/xslt/mallard/common
 
-xsl_DATA = mal-chunk.xsl mal-link.xsl
+xsl_DATA = mal-link.xsl
 
 EXTRA_DIST=$(xsl_DATA)
diff --git a/xslt/mallard/common/mal-link.xsl b/xslt/mallard/common/mal-link.xsl
index 4d3b00e..b5eb525 100644
--- a/xslt/mallard/common/mal-link.xsl
+++ b/xslt/mallard/common/mal-link.xsl
@@ -73,6 +73,15 @@ mal.cache.key
 
 
 <!--@@==========================================================================
+mal.link.extension
+The filename extension for output files.
+
+FIXME
+-->
+<xsl:param name="mal.link.extension"/>
+
+
+<!--@@==========================================================================
 mal.link.default_root
 The default root ID.
 
@@ -223,7 +232,7 @@ $href: The #{href} attribute of ${node}.
 
 This template outputs a URL for a #{link} element or another element using
 linking attributes.  If ${xref} points to a valid page or section, it uses
-a file name based on the ID of the target page plus @{mal.chunk.extension}.
+a file name based on the ID of the target page plus @{mal.link.extension}.
 Otherwise, the link will point to ${href}.
 -->
 <xsl:template name="mal.link.target">
@@ -246,12 +255,12 @@ Otherwise, the link will point to ${href}.
       <xsl:variable name="pageid" select="substring-before($xref, '#')"/>
       <xsl:variable name="sectionid" select="substring-after($xref, '#')"/>
       <xsl:if test="$pageid != ''">
-        <xsl:value-of select="concat($pageid, $mal.chunk.extension)"/>
+        <xsl:value-of select="concat($pageid, $mal.link.extension)"/>
       </xsl:if>
       <xsl:value-of select="concat('#', $sectionid)"/>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:value-of select="concat($xref, $mal.chunk.extension)"/>
+      <xsl:value-of select="concat($xref, $mal.link.extension)"/>
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>
diff --git a/xslt/mallard/html/mal2html-css.xsl b/xslt/mallard/html/mal2html-css.xsl
index 11fd6e5..a364bdb 100644
--- a/xslt/mallard/html/mal2html-css.xsl
+++ b/xslt/mallard/html/mal2html-css.xsl
@@ -17,90 +17,28 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 -->
 
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+                xmlns:mal="http://projectmallard.org/1.0/";
                 xmlns:exsl="http://exslt.org/common";
                 xmlns="http://www.w3.org/1999/xhtml";
+                exclude-result-prefixes="mal"
                 extension-element-prefixes="exsl"
                 version="1.0">
 
-<!--!!==========================================================================
-Mallard to HTML - CSS
-:Requires: theme-colors theme-html
-
-REMARK: Describe this module
--->
-
-
-<!--@@==========================================================================
-mal2html.css.file
-The file to output CSS to
-
-This parameter allows you to output the CSS to separate file which is referenced
-by each HTML file.  If this parameter is blank, then the CSS is embedded inside
-a #{style} tag in the HTML instead.
--->
-<xsl:param name="mal2html.css.file" select="''"/>
-
-
-<!--**==========================================================================
-mal2html.css
-Outputs the CSS that controls the appearance of the entire document
-$css_file: Whether to create a CSS file when @{mal2html.css.file} is set.
-
-This template outputs a #{style} or #{link} tag and calls *{mal2html.css.content}
-to output the actual CSS directives.  An external CSS file will only be created
-when ${css_file} is true.
--->
-<xsl:template name="mal2html.css">
-  <xsl:param name="css_file" select="false()"/>
-  <xsl:choose>
-    <xsl:when test="$mal2html.css.file != ''">
-      <xsl:if test="$css_file">
-        <exsl:document href="{$mal2html.css.file}" method="text">
-          <xsl:call-template name="mal2html.css.content"/>
-        </exsl:document>
-      </xsl:if>
-      <link rel="stylesheet" type="text/css" href="{$mal2html.css.file}"/>
-    </xsl:when>
-    <xsl:otherwise>
-      <style type="text/css">
-        <xsl:call-template name="mal2html.css.content"/>
-      </style>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-
-<!--**==========================================================================
-mal2html.css.content
-Outputs the actual CSS directives
-
-This template is called by *{mal2html.css} to output CSS content.  It also calls
-templates from other modules to output CSS specific to the content addressed in
-those modules.
-
-This template calls *{mal2html.css.custom} at the end.  That template may be used
-by extension stylesheets to extend or override the CSS.
--->
-<xsl:template name="mal2html.css.content">
-  <xsl:variable name="direction">
+<xsl:template mode="html.css.mode" match="mal:page">
+  <xsl:param name="direction">
     <xsl:call-template name="l10n.direction"/>
-  </xsl:variable>
-  <xsl:variable name="left">
+  </xsl:param>
+  <xsl:param name="left">
     <xsl:call-template name="l10n.align.start">
       <xsl:with-param name="direction" select="$direction"/>
     </xsl:call-template>
-  </xsl:variable>
-  <xsl:variable name="right">
+  </xsl:param>
+  <xsl:param name="right">
     <xsl:call-template name="l10n.align.end">
       <xsl:with-param name="direction" select="$direction"/>
     </xsl:call-template>
-  </xsl:variable>
-  <xsl:call-template name="theme.html.css">
-    <xsl:with-param name="direction" select="$direction"/>
-    <xsl:with-param name="left" select="$left"/>
-    <xsl:with-param name="right" select="$right"/>
-  </xsl:call-template>
-  <xsl:text>
+  </xsl:param>
+<xsl:text>
 div.floatleft {
   float: left;
   margin-top: 0;
@@ -204,42 +142,7 @@ span.hi {
     <xsl:value-of select="$theme.color.yellow_background"/><xsl:text>;
 }
 </xsl:text>
-<xsl:call-template name="mal2html.css.editor"/>
-<xsl:call-template name="mal2html.css.custom"/>
-</xsl:template>
-<!--
-2.4
-2
-1.72
-1.44
-1.2
-1
-0.83
-0.69
-0.5
--->
-
-
-<!--**==========================================================================
-mal2html.css.editor
-Outputs CSS for editor mode
-
-FIXME
--->
-<xsl:template name="mal2html.css.editor">
-  <xsl:variable name="direction">
-    <xsl:call-template name="l10n.direction"/>
-  </xsl:variable>
-  <xsl:variable name="left">
-    <xsl:call-template name="l10n.align.start">
-      <xsl:with-param name="direction" select="$direction"/>
-    </xsl:call-template>
-  </xsl:variable>
-  <xsl:variable name="right">
-    <xsl:call-template name="l10n.align.end">
-      <xsl:with-param name="direction" select="$direction"/>
-    </xsl:call-template>
-  </xsl:variable>
+<xsl:if test="$mal2html.editor_mode">
 <xsl:text>
 div.version {
   position: absolute;
@@ -294,17 +197,7 @@ div.comment div.cite {
   font-style: italic;
 }
 </xsl:text>
+</xsl:if>
 </xsl:template>
 
-
-<!--**==========================================================================
-mal2html.css.custom
-Allows extension stylesheets to extend or override CSS
-:Stub: true
-
-This stub template has no content.  Extension stylesheets can override this
-template to output extra CSS.
--->
-<xsl:template name="mal2html.css.custom"/>
-
 </xsl:stylesheet>
diff --git a/xslt/mallard/html/mal2html-list.xsl b/xslt/mallard/html/mal2html-list.xsl
index 2b1987a..0e04bd8 100644
--- a/xslt/mallard/html/mal2html-list.xsl
+++ b/xslt/mallard/html/mal2html-list.xsl
@@ -71,7 +71,7 @@ FIXME
   </xsl:variable>
   <div class="list">
     <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
-    <xsl:element name="{$el}" namespace="{$mal2html.namespace}">
+    <xsl:element name="{$el}" namespace="{$html.namespace}">
       <xsl:attribute name="class">
         <xsl:text>list</xsl:text>
         <xsl:if test="contains($style, ' compact ')">
diff --git a/xslt/mallard/html/mal2html-page.xsl b/xslt/mallard/html/mal2html-page.xsl
index d7b5f3d..4b117bb 100644
--- a/xslt/mallard/html/mal2html-page.xsl
+++ b/xslt/mallard/html/mal2html-page.xsl
@@ -56,7 +56,7 @@ Copyright information is output in a #{div} element with #{class="copyrights"}.
 Each copyright is output in a nested #{div} element with #{class="copyright"}.
 -->
 <xsl:template name="mal2html.page.copyrights">
-  <xsl:param name="node"/>
+  <xsl:param name="node" select="."/>
   <div class="copyrights">
     <xsl:for-each select="$node/mal:info/mal:credit[mal:years]">
       <div class="copyright">
@@ -257,17 +257,14 @@ REMARK: Describe this template
   </xsl:variable>
   <xsl:variable name="seealsonodes" select="exsl:node-set($seealsolinks)/*"/>
   <xsl:if test="$guidenodes or $seealsonodes">
-    <div class="sect autolinkssection">
-      <div class="header">
-        <xsl:element name="{concat('h', $depth)}" namespace="{$mal2html.namespace}">
-          <xsl:attribute name="class">
-            <xsl:text>title</xsl:text>
-          </xsl:attribute>
+    <section class="autolinks">
+      <hgroup>
+        <h1 class="title">
           <xsl:call-template name="l10n.gettext">
             <xsl:with-param name="msgid" select="'Further Reading'"/>
           </xsl:call-template>
-        </xsl:element>
-      </div>
+        </h1>
+      </hgroup>
       <!-- FIXME: For prev/next series, insert links to first/prev/next/last -->
       <div class="autolinks">
         <xsl:if test="$guidenodes">
@@ -303,7 +300,7 @@ REMARK: Describe this template
           </ul>
         </xsl:if>
       </div>
-    </div>
+    </section>
   </xsl:if>
 </xsl:template>
 
@@ -345,46 +342,7 @@ REMARK: Describe this template
 </xsl:template>
 
 
-<!--**==========================================================================
-mal2html.page.head.extra
-FIXME
-:Stub: true
-
-REMARK: Describe this stub template.
--->
-<xsl:template name="mal2html.page.head.extra"/>
-
-
-<!--**==========================================================================
-mal2html.page.headbar
-FIXME
-
-REMARK: FIXME
--->
-<xsl:template name="mal2html.page.headbar">
-  <xsl:param name="node" select="."/>
-  <div class="head">
-    <xsl:call-template name="mal2html.page.linktrails">
-      <xsl:with-param name="node" select="$node"/>
-    </xsl:call-template>
-  </div>
-</xsl:template>
-
-
-<!--**==========================================================================
-mal2html.page.footbar
-FIXME
 
-REMARK: FIXME
--->
-<xsl:template name="mal2html.page.footbar">
-  <xsl:param name="node" select="."/>
-  <div class="foot">
-    <xsl:call-template name="mal2html.page.copyrights">
-      <xsl:with-param name="node" select="$node"/>
-    </xsl:call-template>
-  </div>
-</xsl:template>
 
 
 <!--**==========================================================================
@@ -463,156 +421,148 @@ REMARK: Describe this template
   </xsl:for-each>
 </xsl:template>
 
+<xsl:template name="mal2html.page.prevnextlinks">
+  <xsl:param name="node" select="."/>
+  <xsl:variable name="linkid">
+    <xsl:call-template name="mal.link.linkid">
+      <xsl:with-param name="node" select="$node"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <xsl:variable name="next" select="$node/mal:info/mal:link[ type='next']"/>
+  <xsl:for-each select="$mal.cache">
+    <xsl:variable name="prev" select="key('mal.cache.link.key', concat('next:', $linkid))"/>
+    <xsl:if test="$prev or $next">
+      <!-- FIXME: Get prev/next links in constant position -->
+      <div class="navbar">
+        <xsl:if test="$prev">
+          <a class="navbar-prev">
+            <xsl:attribute name="href">
+              <xsl:call-template name="mal.link.target">
+                <xsl:with-param name="node" select="$prev"/>
+                <xsl:with-param name="xref" select="$prev/../../@id"/>
+              </xsl:call-template>
+            </xsl:attribute>
+            <xsl:call-template name="l10n.gettext">
+              <xsl:with-param name="msgid" select="'Previous'"/>
+            </xsl:call-template>
+          </a>
+        </xsl:if>
+        <xsl:if test="$prev and $next">
+          <xsl:text>&#x00A0;&#x00A0;|&#x00A0;&#x00A0;</xsl:text>
+        </xsl:if>
+        <xsl:if test="$next">
+          <a class="navbar-next">
+            <xsl:attribute name="href">
+              <xsl:call-template name="mal.link.target">
+                <xsl:with-param name="node" select="$next"/>
+                <xsl:with-param name="xref" select="$next/@xref"/>
+              </xsl:call-template>
+            </xsl:attribute>
+            <xsl:call-template name="l10n.gettext">
+              <xsl:with-param name="msgid" select="'Next'"/>
+            </xsl:call-template>
+          </a>
+        </xsl:if>
+      </div>
+    </xsl:if>
+  </xsl:for-each>
+</xsl:template>
+
+<xsl:template name="mal2html.page.versionbanner">
+  <xsl:param name="node" select="."/>
+  <xsl:if test="$mal2html.editor_mode">
+    <xsl:variable name="date">
+      <xsl:for-each select="$node/mal:info/mal:revision">
+        <xsl:sort select="@date" data-type="text" order="descending"/>
+        <xsl:if test="position() = 1">
+          <xsl:value-of select="@date"/>
+        </xsl:if>
+      </xsl:for-each>
+    </xsl:variable>
+    <xsl:variable name="revision"
+                  select="$node/mal:info/mal:revision[ date = $date][last()]"/>
+    <xsl:if test="$revision/@status != ''">
+      <div class="version">
+        <!-- FIXME: i18n -->
+        <div class="title">
+          <xsl:choose>
+            <xsl:when test="$revision/@status = 'stub'">
+              <xsl:call-template name="l10n.gettext">
+                <xsl:with-param name="msgid" select="'Stub'"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:when test="$revision/@status = 'incomplete'">
+              <xsl:call-template name="l10n.gettext">
+                <xsl:with-param name="msgid" select="'Incomplete'"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:when test="$revision/@status = 'draft'">
+              <xsl:call-template name="l10n.gettext">
+                <xsl:with-param name="msgid" select="'Draft'"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:when test="$revision/@status = 'review'">
+              <xsl:call-template name="l10n.gettext">
+                <xsl:with-param name="msgid" select="'Ready for review'"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:when test="$revision/@status = 'final'">
+              <xsl:call-template name="l10n.gettext">
+                <xsl:with-param name="msgid" select="'Final'"/>
+              </xsl:call-template>
+            </xsl:when>
+          </xsl:choose>
+        </div>
+        <p class="version">
+          <!-- FIXME: i18n -->
+          <xsl:text>Version </xsl:text>
+          <xsl:value-of select="$revision/@version"/>
+          <xsl:text> on </xsl:text>
+          <xsl:value-of select="$revision/@date"/>
+        </p>
+        <xsl:apply-templates mode="mal2html.block.mode" select="$revision/*"/>
+      </div>
+    </xsl:if>
+  </xsl:if>
+</xsl:template>
 
 <!-- == Matched Templates == -->
 
 <!-- = / = -->
 <xsl:template match="/">
+  <xsl:call-template name="html.output">
+    <xsl:with-param name="node" select="*"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template mode="html.title.mode" match="mal:page">
+  <xsl:variable name="title" select="mal:info/mal:title[ type = 'text'][1]"/>
   <xsl:choose>
-    <xsl:when test="$mal.chunk.chunk_top">
-      <xsl:call-template name="mal.chunk">
-        <xsl:with-param name="node" select="mal:page"/>
-      </xsl:call-template>
+    <xsl:when test="$title">
+      <xsl:value-of select="$title"/>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:apply-templates mode="mal.chunk.content.mode" select="mal:page"/>
+      <xsl:value-of select="mal:title"/>
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>
 
-<!-- = mal:page % mal.chunk.content.mode = -->
-<xsl:template mode="mal.chunk.content.mode" match="mal:page">
-  <!-- FIXME: find a way to just select the version element -->
-  <xsl:variable name="date">
-    <xsl:for-each select="mal:info/mal:revision">
-      <xsl:sort select="@date" data-type="text" order="descending"/>
-      <xsl:if test="position() = 1">
-        <xsl:value-of select="@date"/>
-      </xsl:if>
-    </xsl:for-each>
-  </xsl:variable>
-  <xsl:variable name="revision"
-                select="mal:info/mal:revision[ date = $date][last()]"/>
-  <html>
-    <head>
-      <title>
-        <xsl:variable name="title" select="mal:info/mal:title[ type = 'text'][1]"/>
-        <xsl:choose>
-          <xsl:when test="$title">
-            <xsl:value-of select="$title"/>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:value-of select="mal:title"/>
-          </xsl:otherwise>
-        </xsl:choose>
-      </title>
-      <xsl:call-template name="mal2html.css"/>
-      <xsl:call-template name="mal2html.page.head.extra"/>
-    </head>
-    <body class="{ style}">
-      <xsl:call-template name="mal2html.page.headbar">
-        <xsl:with-param name="node" select="."/>
-      </xsl:call-template>
-      <div class="body">
-        <xsl:variable name="linkid">
-          <xsl:call-template name="mal.link.linkid"/>
-        </xsl:variable>
-        <xsl:variable name="next" select="mal:info/mal:link[ type='next']"/>
-        <xsl:for-each select="$mal.cache">
-          <xsl:variable name="prev" select="key('mal.cache.link.key', concat('next:', $linkid))"/>
-          <xsl:if test="$prev or $next">
-            <!-- FIXME: Get prev/next links in constant position -->
-            <div class="navbar">
-              <xsl:if test="$prev">
-                <a class="navbar-prev">
-                  <xsl:attribute name="href">
-                    <xsl:call-template name="mal.link.target">
-                      <xsl:with-param name="node" select="$prev"/>
-                      <xsl:with-param name="xref" select="$prev/../../@id"/>
-                    </xsl:call-template>
-                  </xsl:attribute>
-                  <xsl:call-template name="l10n.gettext">
-                    <xsl:with-param name="msgid" select="'Previous'"/>
-                  </xsl:call-template>
-                </a>
-              </xsl:if>
-              <xsl:if test="$prev and $next">
-                <xsl:text>&#x00A0;&#x00A0;|&#x00A0;&#x00A0;</xsl:text>
-              </xsl:if>
-              <xsl:if test="$next">
-                <a class="navbar-next">
-                  <xsl:attribute name="href">
-                    <xsl:call-template name="mal.link.target">
-                      <xsl:with-param name="node" select="$next"/>
-                      <xsl:with-param name="xref" select="$next/@xref"/>
-                    </xsl:call-template>
-                  </xsl:attribute>
-                  <xsl:call-template name="l10n.gettext">
-                    <xsl:with-param name="msgid" select="'Next'"/>
-                  </xsl:call-template>
-                </a>
-              </xsl:if>
-            </div>
-          </xsl:if>
-        </xsl:for-each>
-        <xsl:if test="$mal2html.editor_mode and $revision/@status != ''">
-          <div class="version">
-            <!-- FIXME: i18n -->
-            <div class="title">
-              <xsl:choose>
-                <xsl:when test="$revision/@status = 'stub'">
-                  <xsl:call-template name="l10n.gettext">
-                    <xsl:with-param name="msgid" select="'Stub'"/>
-                  </xsl:call-template>
-                </xsl:when>
-                <xsl:when test="$revision/@status = 'incomplete'">
-                  <xsl:call-template name="l10n.gettext">
-                    <xsl:with-param name="msgid" select="'Incomplete'"/>
-                   </xsl:call-template>
-                </xsl:when>
-                <xsl:when test="$revision/@status = 'draft'">
-                  <xsl:call-template name="l10n.gettext">
-                    <xsl:with-param name="msgid" select="'Draft'"/>
-                  </xsl:call-template>
-                </xsl:when>
-                <xsl:when test="$revision/@status = 'review'">
-                  <xsl:call-template name="l10n.gettext">
-                    <xsl:with-param name="msgid" select="'Ready for review'"/>
-                  </xsl:call-template>
-                </xsl:when>
-                <xsl:when test="$revision/@status = 'final'">
-                  <xsl:call-template name="l10n.gettext">
-                    <xsl:with-param name="msgid" select="'Final'"/>
-                  </xsl:call-template>
-                </xsl:when>
-              </xsl:choose>
-            </div>
-            <p class="version">
-              <!-- FIXME: i18n -->
-              <xsl:text>Version </xsl:text>
-              <xsl:value-of select="$revision/@version"/>
-              <xsl:text> on </xsl:text>
-              <xsl:value-of select="$revision/@date"/>
-            </p>
-            <xsl:apply-templates mode="mal2html.block.mode" select="$revision/*"/>
-          </div>
-        </xsl:if>
-        <xsl:apply-templates select="."/>
-      </div>
-      <xsl:call-template name="mal2html.page.footbar">
-        <xsl:with-param name="node" select="."/>
-      </xsl:call-template>
-    </body>
-  </html>
+<xsl:template mode="html.header.mode" match="mal:page">
+  <xsl:call-template name="mal2html.page.linktrails"/>
+</xsl:template>
+
+<xsl:template mode="html.footer.mode" match="mal:page">
+  <xsl:call-template name="mal2html.page.copyrights"/>
 </xsl:template>
 
-<!-- = page = -->
-<xsl:template match="mal:page">
-  <div class="header">
+<xsl:template mode="html.body.mode" match="mal:page">
+  <xsl:call-template name="mal2html.page.prevnextlinks"/>
+  <xsl:call-template name="mal2html.page.versionbanner"/>
+  <hgroup>
     <xsl:apply-templates mode="mal2html.title.mode" select="mal:title"/>
     <xsl:apply-templates mode="mal2html.title.mode" select="mal:subtitle"/>
-  </div>
-  <div class="page-inner">
+  </hgroup>
+  <div class="inner">
     <xsl:for-each
         select="*[not(self::mal:section or self::mal:title or self::mal:subtitle)]">
       <xsl:apply-templates mode="mal2html.block.mode" select="."/>
@@ -629,12 +579,12 @@ REMARK: Describe this template
 
 <!-- = section = -->
 <xsl:template match="mal:section">
-  <div class="sect section" id="{ id}">
-    <div class="header">
+  <section id="{ id}">
+    <hgroup>
       <xsl:apply-templates mode="mal2html.title.mode" select="mal:title"/>
       <xsl:apply-templates mode="mal2html.title.mode" select="mal:subtitle"/>
-    </div>
-    <div class="section-inner">
+    </hgroup>
+    <div class="inner">
       <xsl:for-each
           select="*[not(self::mal:section or self::mal:title or self::mal:subtitle)]">
         <xsl:apply-templates mode="mal2html.block.mode" select="."/>
@@ -647,7 +597,7 @@ REMARK: Describe this template
     <xsl:call-template name="mal2html.page.autolinks">
       <xsl:with-param name="node" select="."/>
     </xsl:call-template>
-  </div>
+  </section>
 </xsl:template>
 
 
@@ -659,19 +609,16 @@ FIXE
 -->
 <!-- = subtitle = -->
 <xsl:template mode="mal2html.title.mode" match="mal:subtitle">
-  <!-- FIXME -->
+  <h2 class="subtitle">
+    <xsl:apply-templates mode="mal2html.inline.mode"/>
+  </h2>
 </xsl:template>
 
 <!-- = title = -->
 <xsl:template mode="mal2html.title.mode" match="mal:title">
-  <xsl:variable name="depth"
-                select="count(ancestor::mal:section) + 1"/>
-  <xsl:element name="{concat('h', $depth)}" namespace="{$mal2html.namespace}">
-    <xsl:attribute name="class">
-      <xsl:text>title</xsl:text>
-    </xsl:attribute>
+  <h1 class="title">
     <xsl:apply-templates mode="mal2html.inline.mode"/>
-  </xsl:element>
+  </h1>
 </xsl:template>
 
 </xsl:stylesheet>
diff --git a/xslt/mallard/html/mal2html.xsl b/xslt/mallard/html/mal2html.xsl
index e2cfd2d..a9d807c 100644
--- a/xslt/mallard/html/mal2html.xsl
+++ b/xslt/mallard/html/mal2html.xsl
@@ -17,60 +17,21 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 -->
 
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
-                xmlns:mal="http://projectmallard.org/1.0/";
                 xmlns:html="http://www.w3.org/1999/xhtml";
-                exclude-result-prefixes="mal"
+                exclude-result-prefixes="html"
                 version="1.0">
 
-<xsl:import href="../../gettext/gettext.xsl"/>
-
-<!--#@ mal.chunk.doctype_public -->
-<xsl:param name="mal.chunk.doctype_public" select="'-//W3C//DTD HTML 4.01 Transitional//EN'"/>
-
-<!--#@ mal.chunk.doctype_system -->
-<xsl:param name="mal.chunk.doctype_system" select="'http://www.w3.org/TR/html4/loose.dtd'"/>
-
-<xsl:output method="html"
-            doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
-            doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>
-<xsl:namespace-alias stylesheet-prefix="html" result-prefix="#default"/>
-
-<!--#@ mal2html.namespace -->
-<xsl:param name="mal2html.namespace" select="''"/>
-
-<xsl:param name="mal.chunk.extension" select="'.html'"/>
-
-
 <!--!!==========================================================================
 Mallard to HTML
 
 REMARK: Describe this module
 -->
 
-<xsl:include href="../common/mal-chunk.xsl"/>
-<xsl:include href="../common/mal-link.xsl"/>
+<xsl:include href="mal2xhtml.xsl" pass="true"><?pass?></xsl:include>
 
-<xsl:include href="mal2html-block.xsl"/>
-<xsl:include href="mal2html-css.xsl"/>
-<xsl:include href="mal2html-inline.xsl"/>
-<xsl:include href="mal2html-list.xsl"/>
-<xsl:include href="mal2html-media.xsl"/>
-<xsl:include href="mal2html-page.xsl"/>
-<xsl:include href="mal2html-svg.xsl"/>
-<xsl:include href="mal2html-table.xsl"/>
+<!--#@ html.xhtml -->
+<xsl:param name="html.xhtml" select="false()"/>
 
-<xsl:include href="../../common/utils.xsl"/>
-<xsl:include href="../../theme/theme-colors.xsl"/>
-<xsl:include href="../../theme/theme-icons.xsl"/>
-<xsl:include href="../../theme/theme-html.xsl"/>
-
-<!-- FIXME -->
-<xsl:template match="*">
-  <xsl:message>
-    <xsl:text>Unmatched element: </xsl:text>
-    <xsl:value-of select="local-name(.)"/>
-  </xsl:message>
-  <xsl:apply-templates/>
-</xsl:template>
+<xsl:namespace-alias stylesheet-prefix="html" result-prefix="#default"/>
 
 </xsl:stylesheet>
diff --git a/xslt/mallard/html/mal2xhtml.xsl b/xslt/mallard/html/mal2xhtml.xsl
index f52352c..6bd1057 100644
--- a/xslt/mallard/html/mal2xhtml.xsl
+++ b/xslt/mallard/html/mal2xhtml.xsl
@@ -23,31 +23,22 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
                 version="1.0">
 
 
-<xsl:import href="../../gettext/gettext.xsl"/>
-
-<!--#@ mal.chunk.doctype_public -->
-<xsl:param name="mal.chunk.doctype_public" select="'-//W3C//DTD XHTML 1.0 Strict//EN'"/>
-
-<!--#@ mal.chunk.doctype_system -->
-<xsl:param name="mal.chunk.doctype_system" select="'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'"/>
-
-<xsl:output method="xml"
-            doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
-            doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
-
-<!--#@ mal2html.namespace -->
-<xsl:param name="mal2html.namespace" select="'http://www.w3.org/1999/xhtml'"/>
-
-<xsl:param name="mal.chunk.extension" select="'.xhtml'"/>
-
 <!--!!==========================================================================
-Mallard to HTML
+Mallard to XHTML
 
 REMARK: Describe this module
 -->
 
-<xsl:include href="../common/mal-chunk.xsl"/>
-<xsl:include href="../common/mal-link.xsl"/>
+<xsl:import href="../../gettext/gettext.xsl"/>
+<xsl:import href="../../common/html.xsl"/>
+<xsl:import href="../common/mal-link.xsl"/>
+
+<xsl:import href="../../common/utils.xsl"/>
+<xsl:import href="../../theme/theme-colors.xsl"/>
+<xsl:import href="../../theme/theme-icons.xsl"/>
+<xsl:import href="../../theme/theme-html.xsl"/>
+
+<xsl:param name="mal.link.extension" select="$html.extension"/>
 
 <xsl:include href="mal2html-block.xsl"/>
 <xsl:include href="mal2html-css.xsl"/>
@@ -58,18 +49,5 @@ REMARK: Describe this module
 <xsl:include href="mal2html-svg.xsl"/>
 <xsl:include href="mal2html-table.xsl"/>
 
-<xsl:include href="../../common/utils.xsl"/>
-<xsl:include href="../../theme/theme-colors.xsl"/>
-<xsl:include href="../../theme/theme-icons.xsl"/>
-<xsl:include href="../../theme/theme-html.xsl"/>
-
-<!-- FIXME -->
-<xsl:template match="*">
-  <xsl:message>
-    <xsl:text>Unmatched element: </xsl:text>
-    <xsl:value-of select="local-name(.)"/>
-  </xsl:message>
-  <xsl:apply-templates/>
-</xsl:template>
 
 </xsl:stylesheet>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]