summaryrefslogtreecommitdiff
path: root/xslt
diff options
context:
space:
mode:
authorShaun McCance <shaunm@shaunmlxlap.localdomain>2009-06-14 21:44:14 -0500
committerShaun McCance <shaunm@shaunmlxlap.localdomain>2009-06-14 21:44:14 -0500
commit5a815acf0b065d80cd968cc2584e66940d89d388 (patch)
tree437f082181e4b037cd44d45d1e4abff9634e3c44 /xslt
parente0bc7746c950487e92e811388d55da4ce0384b85 (diff)
parent9f55fd78a1ef29ec283b4021e85aefbb6d36a36e (diff)
downloadgnome-doc-utils-5a815acf0b065d80cd968cc2584e66940d89d388.tar.gz
Merge branch 'mallard'
Diffstat (limited to 'xslt')
-rw-r--r--xslt/Makefile.am2
-rw-r--r--xslt/common/Makefile.am2
-rw-r--r--xslt/common/theme.xsl11
-rw-r--r--xslt/common/utils.xsl82
-rw-r--r--xslt/docbook/html/db2xhtml.xsl2
-rw-r--r--xslt/mallard/Makefile.am1
-rw-r--r--xslt/mallard/common/Makefile.am5
-rw-r--r--xslt/mallard/common/mal-chunk.xsl85
-rw-r--r--xslt/mallard/common/mal-link.xsl170
-rw-r--r--xslt/mallard/html/Makefile.am14
-rw-r--r--xslt/mallard/html/mal2html-block.xsl494
-rw-r--r--xslt/mallard/html/mal2html-css.xsl284
-rw-r--r--xslt/mallard/html/mal2html-inline.xsl322
-rw-r--r--xslt/mallard/html/mal2html-list.xsl292
-rw-r--r--xslt/mallard/html/mal2html-media.xsl96
-rw-r--r--xslt/mallard/html/mal2html-page.xsl616
-rw-r--r--xslt/mallard/html/mal2html-table.xsl424
-rw-r--r--xslt/mallard/html/mal2html.xsl82
-rw-r--r--xslt/mallard/html/mal2xhtml.xsl81
-rw-r--r--xslt/mallard/utils/Makefile.am5
-rw-r--r--xslt/mallard/utils/mal2cache.xsl119
21 files changed, 3186 insertions, 3 deletions
diff --git a/xslt/Makefile.am b/xslt/Makefile.am
index 328783f..d9466fd 100644
--- a/xslt/Makefile.am
+++ b/xslt/Makefile.am
@@ -1 +1 @@
-SUBDIRS = gettext docbook common # gettext needs to be first
+SUBDIRS = gettext docbook mallard common # gettext needs to be first
diff --git a/xslt/common/Makefile.am b/xslt/common/Makefile.am
index cd17dd8..0414184 100644
--- a/xslt/common/Makefile.am
+++ b/xslt/common/Makefile.am
@@ -1,6 +1,6 @@
xsldir=$(datadir)/xml/gnome/xslt/common
-xsl_DATA = theme.xsl
+xsl_DATA = theme.xsl utils.xsl
EXTRA_DIST=$(xsl_DATA)
diff --git a/xslt/common/theme.xsl b/xslt/common/theme.xsl
index c078c76..ac21fa5 100644
--- a/xslt/common/theme.xsl
+++ b/xslt/common/theme.xsl
@@ -255,4 +255,15 @@ document is written in.
</xsl:call-template>
</xsl:param>
+<!--@@==========================================================================
+theme.watermark.code
+The path for the code block watermark graphic
+
+This parameter specifies the graphic file used for code block watermarks.
+-->
+<xsl:param name="theme.watermark.code">
+ <xsl:value-of select="$theme.watermark.path"/>
+ <xsl:text>watermark-code.png</xsl:text>
+</xsl:param>
+
</xsl:stylesheet>
diff --git a/xslt/common/utils.xsl b/xslt/common/utils.xsl
new file mode 100644
index 0000000..55315d5
--- /dev/null
+++ b/xslt/common/utils.xsl
@@ -0,0 +1,82 @@
+<?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"
+ version="1.0">
+
+<!--!!==========================================================================
+Common XSLT Utilities
+
+REMARK: Describe this module
+-->
+
+
+<!--**==========================================================================
+utils.strip_newlines
+Strips leading or trailing newlines from a string
+$string: The string to strip newlines from
+$leading: Whether to strip leading newlines
+$trailing: Whether to strip trailing newlines
+
+This template strips at most one leading and one trailing newline from
+${string}. This is useful for preformatted block elements where leading and
+trailing newlines are ignored to make source formatting easier for authors.
+-->
+<xsl:template name="utils.strip_newlines">
+ <xsl:param name="string"/>
+ <xsl:param name="leading" select="false()"/>
+ <xsl:param name="trailing" select="false()"/>
+ <xsl:choose>
+ <xsl:when test="$leading">
+ <xsl:variable name="new">
+ <xsl:choose>
+ <xsl:when test="starts-with($string, '&#x000A;')">
+ <xsl:value-of select="substring($string, 2)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$trailing">
+ <xsl:call-template name="utils.strip_newlines">
+ <xsl:with-param name="string" select="$new"/>
+ <xsl:with-param name="leading" select="false()"/>
+ <xsl:with-param name="trailing" select="true()"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$new"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$trailing">
+ <xsl:choose>
+ <xsl:when test="substring($string, string-length($string)) = '&#x000A;'">
+ <xsl:value-of select="substring($string, 1, string-length($string) - 1 )"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/docbook/html/db2xhtml.xsl b/xslt/docbook/html/db2xhtml.xsl
index 629e415..d043983 100644
--- a/xslt/docbook/html/db2xhtml.xsl
+++ b/xslt/docbook/html/db2xhtml.xsl
@@ -28,7 +28,7 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
<!--#@ db.chunk.doctype_system -->
<xsl:param name="db.chunk.doctype_system" select="'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'"/>
-<xsl:output method="html"
+<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"/>
diff --git a/xslt/mallard/Makefile.am b/xslt/mallard/Makefile.am
new file mode 100644
index 0000000..5d6f8e2
--- /dev/null
+++ b/xslt/mallard/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = common html utils
diff --git a/xslt/mallard/common/Makefile.am b/xslt/mallard/common/Makefile.am
new file mode 100644
index 0000000..9501408
--- /dev/null
+++ b/xslt/mallard/common/Makefile.am
@@ -0,0 +1,5 @@
+xsldir=$(datadir)/xml/gnome/xslt/mallard/common
+
+xsl_DATA = mal-chunk.xsl mal-link.xsl
+
+EXTRA_DIST=$(xsl_DATA)
diff --git a/xslt/mallard/common/mal-chunk.xsl b/xslt/mallard/common/mal-chunk.xsl
new file mode 100644
index 0000000..72531c3
--- /dev/null
+++ b/xslt/mallard/common/mal-chunk.xsl
@@ -0,0 +1,85 @@
+<?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:exsl="http://exslt.org/common"
+ extension-element-prefixes="exsl"
+ version="1.0">
+
+<!--!!==========================================================================
+Chunking
+
+REMARK: Describe this module
+-->
+
+
+<!--@@==========================================================================
+mal.chunk.chunk_top
+Whether the top-level page should be output with the chunking mechanism
+
+REMARK: Describe what this does
+-->
+<xsl:param name="mal.chunk.chunk_top" select="false()"/>
+
+
+<!--@@==========================================================================
+mal.chunk.extension
+The default file extension for new output documents
+
+REMARK: Describe what this does
+-->
+<xsl:param name="mal.chunk.extension"/>
+
+
+<!--@@==========================================================================
+mal.chunk.doctype_public
+The public DOCTYPE for output files
+
+REMARK: Describe this
+-->
+<xsl:param name="mal.chunk.doctype_public"/>
+
+
+<!--@@==========================================================================
+mal.chunk.doctype_system
+The system DOCTYPE for output files
+
+REMARK: Describe this
+-->
+<xsl:param name="mal.chunk.doctype_system"/>
+
+
+<!--**==========================================================================
+mal.chunk
+Creates a new page of output
+$node: The source element for the output page
+$href: The name of the file for the output page
+
+REMARK: Describe
+-->
+<xsl:template name="mal.chunk">
+ <xsl:param name="node" select="."/>
+ <xsl:param name="href" select="concat($node/@id, $mal.chunk.extension)"/>
+ <exsl:document href="{$href}"
+ doctype-public="{$mal.chunk.doctype_public}"
+ doctype-system="{$mal.chunk.doctype_system}">
+ <xsl:apply-templates mode="mal.chunk.content.mode" select="$node"/>
+ </exsl:document>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/mallard/common/mal-link.xsl b/xslt/mallard/common/mal-link.xsl
new file mode 100644
index 0000000..8d5d648
--- /dev/null
+++ b/xslt/mallard/common/mal-link.xsl
@@ -0,0 +1,170 @@
+<?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:mal="http://www.gnome.org/~shaunm/mallard"
+ version="1.0">
+
+<!--!!==========================================================================
+Mallard Links
+-->
+
+
+<!--@@==========================================================================
+mal.cache.file
+The location of the cache file
+-->
+<xsl:param name="mal.cache.file"/>
+<xsl:param name="mal.cache" select="document($mal.cache.file)/mal:cache"/>
+<xsl:key name="mal.cache.key" match="mal:page | mal:section" use="@id"/>
+
+
+<!--**==========================================================================
+mal.link.content
+Generates the content for a #{link} element
+$link: The #{link} or other element creating the link
+$xref: The #{xref} attribute of ${link}
+$href: The #{href} attribute of ${link}
+-->
+<xsl:template name="mal.link.content">
+ <xsl:param name="link" select="."/>
+ <xsl:param name="xref" select="$link/@xref"/>
+ <xsl:param name="href" select="$link/@href"/>
+ <xsl:choose>
+ <xsl:when test="contains($xref, '/')">
+ <!--
+ This is a link to another document, which we don't handle in these
+ stylesheets. Extensions such as library or yelp should override
+ this template to provide this functionality.
+ -->
+ <xsl:choose>
+ <xsl:when test="$href">
+ <xsl:value-of select="$href"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$xref"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="fullid">
+ <xsl:choose>
+ <xsl:when test="contains($xref, '#')">
+ <xsl:variable name="pageid" select="substring-before($xref, '#')"/>
+ <xsl:variable name="sectionid" select="substring-after($xref, '#')"/>
+ <xsl:if test="$pageid = ''">
+ <xsl:value-of select="$link/ancestor::mal:page/@id"/>
+ </xsl:if>
+ <xsl:value-of select="concat($pageid, '#', $sectionid)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$xref"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:for-each select="$mal.cache">
+ <xsl:apply-templates mode="mal.link.content.mode"
+ select="key('mal.cache.key', $fullid)
+ /mal:info/mal:title[@type = 'link']/node()"/>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+
+<!--%%==========================================================================
+mal.link.content.mode
+Renders the content of a link from a title
+
+This mode is applied to the contents of a #{title} element by *{mal.link.content}.
+By default, it returns the string value of its input. Stylesheets that import
+this module should override this to call their inline mode.
+-->
+<xsl:template mode="mal.link.content.mode" match="* | text()">
+ <xsl:value-of select="."/>
+</xsl:template>
+
+
+<!--**==========================================================================
+mal.link.target
+Generates the target for a #{link} element
+$link: The #{link} or other element creating the link
+$xref: The #{xref} attribute of ${link}
+$href: The #{href} attribute of ${link}
+-->
+<xsl:template name="mal.link.target">
+ <xsl:param name="link" select="."/>
+ <xsl:param name="xref" select="$link/@xref"/>
+ <xsl:param name="href" select="$link/@href"/>
+ <xsl:choose>
+ <xsl:when test="string($xref) = ''">
+ <xsl:value-of select="$href"/>
+ </xsl:when>
+ <xsl:when test="contains($xref, '/')">
+ <!--
+ This is a link to another document, which we don't handle in these
+ stylesheets. Extensions such as library or yelp should override
+ this template to provide this functionality.
+ -->
+ <xsl:value-of select="$href"/>
+ </xsl:when>
+ <xsl:when test="contains($xref, '#')">
+ <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:if>
+ <xsl:value-of select="concat('#', $sectionid)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($xref, $mal.chunk.extension)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+
+<!--**==========================================================================
+mal.link.tooltip
+Generates the tooltip for a #{link} or other linking element
+$link: The #{link} or other element creating the link
+$xref: The #{xref} attribute of ${link}
+$href: The #{href} attribute of ${link}
+-->
+<xsl:template name="mal.link.tooltip">
+ <xsl:param name="link" select="."/>
+ <xsl:param name="xref" select="$link/@xref"/>
+ <xsl:param name="href" select="$link/@href"/>
+ <xsl:choose>
+ <xsl:when test="string($xref) != ''">
+ <!-- FIXME -->
+ </xsl:when>
+ <xsl:when test="starts-with($href, 'mailto:')">
+ <xsl:variable name="address" select="substring-after($href, 'mailto:')"/>
+ <xsl:call-template name="l10n.gettext">
+ <xsl:with-param name="msgid" select="'email.tooltip'"/>
+ <xsl:with-param name="string" select="$address"/>
+ <xsl:with-param name="format" select="true()"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="normalize-space($href)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/mallard/html/Makefile.am b/xslt/mallard/html/Makefile.am
new file mode 100644
index 0000000..2ac76a7
--- /dev/null
+++ b/xslt/mallard/html/Makefile.am
@@ -0,0 +1,14 @@
+xsldir=$(datadir)/xml/gnome/xslt/mallard/html
+
+xsl_DATA = \
+ mal2html-block.xsl \
+ mal2html-css.xsl \
+ mal2html-inline.xsl \
+ mal2html-list.xsl \
+ mal2html-media.xsl \
+ mal2html-page.xsl \
+ mal2html-table.xsl \
+ mal2html.xsl \
+ mal2xhtml.xsl
+
+EXTRA_DIST=$(xsl_DATA)
diff --git a/xslt/mallard/html/mal2html-block.xsl b/xslt/mallard/html/mal2html-block.xsl
new file mode 100644
index 0000000..49c39fe
--- /dev/null
+++ b/xslt/mallard/html/mal2html-block.xsl
@@ -0,0 +1,494 @@
+<?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:mal="http://www.gnome.org/~shaunm/mallard"
+ xmlns="http://www.w3.org/1999/xhtml"
+ version="1.0">
+
+<!--!!==========================================================================
+Mallard to HTML - Block Elements
+
+REMARK: Describe this module
+-->
+
+
+<!--**==========================================================================
+mal2html.block.css
+Outputs CSS that controls the appearance of block elements
+
+REMARK: Describe this template
+-->
+<xsl:template name="mal2html.block.css">
+<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.desc-listing, div.desc-synopsis { font-style: italic; }
+div.desc-figure { margin: 0.2em 0 0 0; }
+pre.code {
+ background: url('</xsl:text>
+ <xsl:value-of select="$theme.watermark.code"/><xsl:text>') no-repeat top right;
+ border: solid 2px </xsl:text>
+ <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
+ padding: 0.5em 1em 0.5em 1em;
+}
+div.example {
+ border-left: solid 4px </xsl:text>
+ <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
+ padding-left: 1em;
+}
+div.figure {
+ margin-left: 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-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.listing-contents { margin: 0; padding: 0; }
+div.note {
+ padding: 0.5em 6px 0.5em 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-inner {
+ margin: 0;
+ min-height: </xsl:text><xsl:value-of select="$theme.icon.admon.size"/><xsl:text>px;
+ padding-left: </xsl:text>
+ <xsl:value-of select="$theme.icon.admon.size + 12"/><xsl:text>px;
+ background-position: left top;
+ background-repeat: no-repeat;
+ background-image: url("</xsl:text>
+ <xsl:value-of select="$theme.icon.admon.note"/><xsl:text>");
+}
+div.note-advanced div.note-inner { <!-- background-image: url("</xsl:text>
+ <xsl:value-of select="$theme.icon.admon.advanced"/><xsl:text>"); --> }
+div.note-bug div.note-inner { background-image: url("</xsl:text>
+ <xsl:value-of select="$theme.icon.admon.bug"/><xsl:text>"); }
+div.note-important div.note-inner { background-image: url("</xsl:text>
+ <xsl:value-of select="$theme.icon.admon.important"/><xsl:text>"); }
+div.note-tip div.note-inner { background-image: url("</xsl:text>
+ <xsl:value-of select="$theme.icon.admon.tip"/><xsl:text>"); }
+div.note-warning div.note-inner { background-image: url("</xsl:text>
+ <xsl:value-of select="$theme.icon.admon.warning"/><xsl:text>"); }
+div.note-contents { margin: 0; padding: 0; }
+div.quote-inner {
+ margin: 0;
+ <!-- FIXME: i18n -->
+ background-image: url('</xsl:text>
+ <xsl:value-of select="$theme.watermark.blockquote"/><xsl:text>');
+ background-repeat: no-repeat;
+ background-position: top left;
+ padding: 0.5em;
+ padding-left: 4em;
+}
+div.title-quote {
+ margin-left: 4em;
+}
+blockquote {
+ margin: 0; padding: 0;
+}
+div.cite-comment {
+ margin-top: 0.5em;
+ color: </xsl:text><xsl:value-of select="$theme.color.text_light"/><xsl:text>;
+}
+div.cite-quote {
+ margin-top: 0.5em;
+ color: </xsl:text><xsl:value-of select="$theme.color.text_light"/><xsl:text>;
+}
+div.cite-quote::before {
+ <!-- FIXME: i18n -->
+ content: '&#x2015; ';
+}
+pre.screen {
+ padding: 0.5em 1em 0.5em 1em;
+ background-color: </xsl:text>
+ <xsl:value-of select="$theme.color.gray_background"/><xsl:text>;
+ border: solid 2px </xsl:text>
+ <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
+}
+div.synopsis-contents {
+ margin: 0;
+ padding: 0.5em 1em 0.5em 1em;
+ border-top: solid 2px;
+ border-bottom: solid 2px;
+ 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 pre.code {
+ background: none;
+ border: none;
+ padding: 0;
+}
+</xsl:text>
+</xsl:template>
+
+
+<!--**==========================================================================
+mal2html.pre
+
+FIXME
+-->
+<xsl:template name="mal2html.pre">
+ <xsl:param name="node" select="."/>
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
+ <xsl:variable name="first" select="$node/node()[1]/self::text()"/>
+ <xsl:variable name="last" select="$node/node()[last()]/self::text()"/>
+ <pre>
+ <xsl:attribute name="class">
+ <xsl:value-of select="local-name($node)"/>
+ <xsl:if test="$first_child">
+ <xsl:text> first-child</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:if test="$first">
+ <xsl:call-template name="utils.strip_newlines">
+ <xsl:with-param name="string" select="$first"/>
+ <xsl:with-param name="leading" select="true()"/>
+ <xsl:with-param name="trailing" select="count(node()) = 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:apply-templates mode="mal2html.inline.mode"
+ select="node()[not(self::text() and (position() = 1 or position() = last()))]"/>
+ <xsl:if test="$last and (count(node()) != 1)">
+ <xsl:call-template name="utils.strip_newlines">
+ <xsl:with-param name="string" select="$last"/>
+ <xsl:with-param name="leading" select="false()"/>
+ <xsl:with-param name="trailing" select="true()"/>
+ </xsl:call-template>
+ </xsl:if>
+ </pre>
+</xsl:template>
+
+
+<!-- == Matched Templates == -->
+
+<!-- = desc = -->
+<xsl:template mode="mal2html.block.mode" match="mal:desc">
+ <div class="desc desc-{local-name(..)}">
+ <xsl:apply-templates mode="mal2html.inline.mode"/>
+ </div>
+</xsl:template>
+
+<!-- = code = -->
+<xsl:template mode="mal2html.block.mode" match="mal:code">
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
+ <xsl:call-template name="mal2html.pre">
+ <xsl:with-param name="first_child" select="$first_child"/>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- = comment = -->
+<xsl:template mode="mal2html.block.mode" match="mal:comment">
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
+ <xsl:if test="$mal2html.editor_mode
+ or processing-instruction('mal2html.show_comment')">
+ <div>
+ <xsl:attribute name="class">
+ <xsl:text>comment</xsl:text>
+ <xsl:if test="$first_child">
+ <xsl:text> first-child</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:cite"/>
+ <xsl:for-each select="mal:*[not(self::mal:title or self::mal:cite)
+ and ($mal2html.editor_mode or not(self::mal:comment)
+ or processing-instruction('mal2html.show_comment'))]">
+ <xsl:apply-templates mode="mal2html.block.mode" select=".">
+ <xsl:with-param name="first_child" select="position() = 1"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
+ </div>
+ </xsl:if>
+</xsl:template>
+
+<!-- = comment/cite = -->
+<xsl:template mode="mal2html.block.mode" match="mal:comment/mal:cite">
+ <div class="cite cite-comment">
+ <!-- FIXME: i18n -->
+ <xsl:text>from </xsl:text>
+ <xsl:choose>
+ <xsl:when test="@href">
+ <a href="{@href}">
+ <xsl:apply-templates mode="mal2html.inline.mode"/>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="mal2html.inline.mode"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@date">
+ <xsl:text> on </xsl:text>
+ <xsl:value-of select="@date"/>
+ </xsl:if>
+ </div>
+</xsl:template>
+
+<!-- = example = -->
+<xsl:template mode="mal2html.block.mode" match="mal:example">
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
+ <div>
+ <xsl:attribute name="class">
+ <xsl:text>example</xsl:text>
+ <xsl:if test="$first_child">
+ <xsl:text> first-child</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:for-each select="mal:*[$mal2html.editor_mode or not(self::mal:comment)
+ or processing-instruction('mal2html.show_comment')]">
+ <xsl:apply-templates mode="mal2html.block.mode" select=".">
+ <xsl:with-param name="first_child" select="position() = 1"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
+ </div>
+</xsl:template>
+
+<!-- = figure = -->
+<xsl:template mode="mal2html.block.mode" match="mal:figure">
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
+ <div>
+ <xsl:attribute name="class">
+ <xsl:text>figure</xsl:text>
+ <xsl:if test="$first_child">
+ <xsl:text> first-child</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
+ <div class="figure-contents">
+ <xsl:for-each select="mal:*[not(self::mal:title or self::mal:desc)
+ and ($mal2html.editor_mode or not(self::mal:comment)
+ or processing-instruction('mal2html.show_comment'))]">
+ <xsl:apply-templates mode="mal2html.block.mode" select=".">
+ <xsl:with-param name="first_child" select="position() = 1"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
+ </div>
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:desc"/>
+ </div>
+</xsl:template>
+
+<!-- = listing = -->
+<xsl:template mode="mal2html.block.mode" match="mal:listing">
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
+ <div>
+ <xsl:attribute name="class">
+ <xsl:text>listing</xsl:text>
+ <xsl:if test="$first_child">
+ <xsl:text> first-child</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:desc"/>
+ <div class="listing-contents">
+ <xsl:for-each select="mal:*[not(self::mal:title or self::mal:desc)
+ and ($mal2html.editor_mode or not(self::mal:comment)
+ or processing-instruction('mal2html.show_comment'))]">
+ <xsl:apply-templates mode="mal2html.block.mode" select=".">
+ <xsl:with-param name="first_child" select="position() = 1"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
+ </div>
+ </div>
+</xsl:template>
+
+<!-- = note = -->
+<xsl:template mode="mal2html.block.mode" match="mal:note">
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
+ <xsl:variable name="notestyle">
+ <xsl:choose>
+ <xsl:when test="contains(concat(' ', @style, ' '), ' advanced ')">
+ <xsl:text>advanced</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains(concat(' ', @style, ' '), ' bug ')">
+ <xsl:text>bug</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains(concat(' ', @style, ' '), ' important ')">
+ <xsl:text>important</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains(concat(' ', @style, ' '), ' tip ')">
+ <xsl:text>tip</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains(concat(' ', @style, ' '), ' warning ')">
+ <xsl:text>warning</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <div>
+ <xsl:attribute name="class">
+ <xsl:text>note</xsl:text>
+ <xsl:if test="normalize-space($notestyle) != ''">
+ <xsl:value-of select="concat(' note-', $notestyle)"/>
+ </xsl:if>
+ <xsl:if test="$first_child">
+ <xsl:text> first-child</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <div class="note-inner">
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
+ <div class="note-contents">
+ <xsl:for-each select="mal:*[not(self::mal:title)
+ and ($mal2html.editor_mode or not(self::mal:comment)
+ or processing-instruction('mal2html.show_comment'))]">
+ <xsl:apply-templates mode="mal2html.block.mode" select=".">
+ <xsl:with-param name="first_child" select="position() = 1"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
+ </div>
+ </div>
+ </div>
+</xsl:template>
+
+<!-- = info = -->
+<xsl:template mode="mal2html.block.mode" match="mal:info"/>
+
+<!-- = p = -->
+<xsl:template mode="mal2html.block.mode" match="mal:p">
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
+ <p>
+ <xsl:attribute name="class">
+ <xsl:text>p</xsl:text>
+ <xsl:if test="$first_child">
+ <xsl:text> first-child</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:apply-templates mode="mal2html.inline.mode"/>
+ </p>
+</xsl:template>
+
+<!-- = quote = -->
+<xsl:template mode="mal2html.block.mode" match="mal:quote">
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
+ <div class="quote">
+ <xsl:attribute name="class">
+ <xsl:text>quote</xsl:text>
+ <xsl:if test="$first_child">
+ <xsl:text> first-child</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
+ <div class="quote-inner">
+ <blockquote class="quote-contents">
+ <xsl:for-each select="mal:*[not(self::mal:title or self::mal:cite)
+ and ($mal2html.editor_mode or not(self::mal:comment)
+ or processing-instruction('mal2html.show_comment'))]">
+ <xsl:apply-templates mode="mal2html.block.mode" select=".">
+ <xsl:with-param name="first_child" select="position() = 1"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
+ </blockquote>
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:cite"/>
+ </div>
+ </div>
+</xsl:template>
+
+<!-- = quote/cite = -->
+<xsl:template mode="mal2html.block.mode" match="mal:quote/mal:cite">
+ <div class="cite cite-quote">
+ <xsl:choose>
+ <xsl:when test="@href">
+ <a href="{@href}">
+ <xsl:apply-templates mode="mal2html.inline.mode"/>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="mal2html.inline.mode"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- FIXME: i18n -->
+ <xsl:if test="@date">
+ <xsl:text> (</xsl:text>
+ <xsl:value-of select="@date"/>
+ <xsl:text>)</xsl:text>
+ </xsl:if>
+ </div>
+</xsl:template>
+
+<!-- = screen = -->
+<xsl:template mode="mal2html.block.mode" match="mal:screen">
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
+ <xsl:call-template name="mal2html.pre">
+ <xsl:with-param name="first_child" select="$first_child"/>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- = synopsis = -->
+<xsl:template mode="mal2html.block.mode" match="mal:synopsis">
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
+ <div class="synopsis">
+ <xsl:attribute name="class">
+ <xsl:text>synopsis</xsl:text>
+ <xsl:if test="$first_child">
+ <xsl:text> first-child</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:desc"/>
+ <div class="synopsis-contents">
+ <xsl:for-each select="mal:*[not(self::mal:title or self::mal:desc)
+ and ($mal2html.editor_mode or not(self::mal:comment)
+ or processing-instruction('mal2html.show_comment'))]">
+ <xsl:apply-templates mode="mal2html.block.mode" select=".">
+ <xsl:with-param name="first_child" select="position() = 1"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
+ </div>
+ </div>
+</xsl:template>
+
+<!-- = title = -->
+<xsl:template mode="mal2html.block.mode" match="mal:title">
+ <div class="title title-{local-name(..)}">
+ <xsl:apply-templates mode="mal2html.inline.mode"/>
+ </div>
+</xsl:template>
+
+<!-- FIXME -->
+<xsl:template mode="mal2html.block.mode" match="*">
+ <xsl:message>
+ <xsl:text>Unmatched block element: </xsl:text>
+ <xsl:value-of select="local-name(.)"/>
+ </xsl:message>
+ <xsl:apply-templates mode="mal2html.inline.mode"/>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/mallard/html/mal2html-css.xsl b/xslt/mallard/html/mal2html-css.xsl
new file mode 100644
index 0000000..71b3a97
--- /dev/null
+++ b/xslt/mallard/html/mal2html-css.xsl
@@ -0,0 +1,284 @@
+<?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:exsl="http://exslt.org/common"
+ xmlns="http://www.w3.org/1999/xhtml"
+ extension-element-prefixes="exsl"
+ version="1.0">
+
+<!--!!==========================================================================
+Mallard to HTML - CSS
+
+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:call-template name="mal2html.block.css"/>
+ <xsl:call-template name="mal2html.inline.css"/>
+ <xsl:call-template name="mal2html.list.css"/>
+ <xsl:call-template name="mal2html.table.css"/>
+<xsl:text>
+html { height: 100%; }
+body {
+ direction: </xsl:text><xsl:call-template name="l10n.direction"/><xsl:text>;
+ margin: 0px;
+ background-color: </xsl:text>
+ <xsl:value-of select="$theme.color.gray_background"/><xsl:text>;
+ padding: 12px;
+ min-height: 100%;
+}
+ul, ol, dl, dd { margin: 0; }
+div, pre, p, li, dt { margin: 1em 0 0 0; padding: 0; }
+.first-child { 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; }
+
+div.head { margin: 0; }
+div.body {
+ margin: 0;
+ padding: 1em;
+ max-width: 48em;
+ min-height: 20em;
+ -moz-border-radius: 6px;
+ 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.copyrights {
+ max-width: 48em;
+ text-align: center;
+ color: </xsl:text>
+ <xsl:value-of select="$theme.color.text_light"/><xsl:text>;
+}
+div.section { margin-top: 2.4em; clear: both; }
+div.section div.section { margin-top: 1.72em; margin-left: 1.72em; }
+div.section div.section div.section { margin-top: 1.44em; }
+div.header {
+ margin: 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 {
+ font-size: 1.44em;
+ margin: 0;
+}
+h2, h3, h4, h5, h6, h7 {
+ font-size: 1.2em;
+ margin: 0;
+}
+table { border-collapse: collapse; }
+
+div.autolinks ul { margin: 0; padding: 0; }
+div.autolinks div.title { margin: 1em 0 0 1em; }
+div.autolinks div.title span {
+ border-bottom: solid 1px </xsl:text>
+ <xsl:value-of select="$theme.color.gray_border"/><xsl:text>;
+}
+li.autolink { margin: 0.5em 0 0 0; padding: 0 0 0 1em; list-style-type: none; }
+
+div.linktrail {
+ font-size: 0.83em;
+ padding-left: 1.2em;
+ margin: 0 1px 0.2em 1px;
+ color: </xsl:text>
+ <xsl:value-of select="$theme.color.text_light"/><xsl:text>;
+}
+
+td.twocolumnleft { width: 48%; vertical-align: top; padding: 0; margin: 0; }
+td.twocolumnright { width: 52%; vertical-align: top; padding: 0 0 0 1em; margin: 0; }
+
+div.pagelink div.title {
+ font-size: 1em;
+ color: inherit;
+}
+div.pagelink {
+ margin: 0;
+ padding: 0.5em;
+ -moz-border-radius: 6px;
+ border: solid 1px </xsl:text>
+ <xsl:value-of select="$theme.color.background"/><xsl:text>;
+}
+div.pagelink:hover {
+ border-color: </xsl:text>
+ <xsl:value-of select="$theme.color.blue_border"/><xsl:text>;
+ background-color: </xsl:text>
+ <xsl:value-of select="$theme.color.blue_background"/><xsl:text>;
+}
+div.pagelinksep {
+ margin: 0.5em;
+ list-style-type: none;
+ max-width: 24em;
+ border-bottom: solid 1px </xsl:text>
+ <xsl:value-of select="$theme.color.gray_border"/><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:text>
+div.version {
+ position: absolute;
+ right: 12px;
+ opacity: 0.2;
+ margin-top: -1em;
+ padding: 0.5em 1em 0.5em 1em;
+ max-width: 24em;
+ -moz-border-radius: 6px;
+ 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.yellow_background"/><xsl:text>;
+}
+div.version:hover { opacity: 0.8; }
+div.version p.version { margin-top: 0.2em; }
+div.pagelink div.title span.status {
+ font-size: 0.83em;
+ font-weight: normal;
+ padding-left: 0.2em;
+ padding-right: 0.2em;
+ color: </xsl:text>
+ <xsl:value-of select="$theme.color.text_light"/><xsl:text>;
+ border: solid 1px </xsl:text>
+ <xsl:value-of select="$theme.color.red_border"/><xsl:text>;
+}
+div.pagelink div.title span.status-stub { background-color: </xsl:text>
+ <xsl:value-of select="$theme.color.red_background"/><xsl:text>; }
+div.pagelink div.title span.status-draft { background-color: </xsl:text>
+ <xsl:value-of select="$theme.color.red_background"/><xsl:text>; }
+div.pagelink div.title span.status-incomplete { background-color: </xsl:text>
+ <xsl:value-of select="$theme.color.red_background"/><xsl:text>; }
+div.pagelink div.title span.status-review { background-color: </xsl:text>
+ <xsl:value-of select="$theme.color.yellow_background"/><xsl:text>; }
+div.pagelink div.desc {
+ margin-top: 0.2em;
+ color: </xsl:text>
+ <xsl:value-of select="$theme.color.text_light"/><xsl:text>;
+}
+div.comment {
+ padding: 0.5em;
+ border: solid 2px </xsl:text>
+ <xsl:value-of select="$theme.color.red_border"/><xsl:text>;
+ background-color: </xsl:text>
+ <xsl:value-of select="$theme.color.red_background"/><xsl:text>;
+}
+div.comment div.comment {
+ margin: 1em 0 0 1em;
+}
+div.comment div.cite {
+ margin: 0 0 0.5em 0;
+ font-style: italic;
+}
+</xsl:text>
+</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-inline.xsl b/xslt/mallard/html/mal2html-inline.xsl
new file mode 100644
index 0000000..036b1f4
--- /dev/null
+++ b/xslt/mallard/html/mal2html-inline.xsl
@@ -0,0 +1,322 @@
+<?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:mal="http://www.gnome.org/~shaunm/mallard"
+ xmlns="http://www.w3.org/1999/xhtml"
+ version="1.0">
+
+<!--!!==========================================================================
+Mallard to HTML - Inline Elements
+
+REMARK: Describe this module
+-->
+
+<xsl:template mode="mal.link.content.mode" match="*">
+ <xsl:apply-templates mode="mal2html.inline.mode" select="."/>
+</xsl:template>
+
+
+<!--%%==========================================================================
+mal2html.inline.mode
+Processes an element in inline mode
+
+FIXME
+-->
+
+
+<!--%%==========================================================================
+mal2html.inline.content.mode
+Outputs the contents of an inline element
+
+FIXME
+-->
+<xsl:template mode="mal2html.inline.content.mode" match="node()">
+ <xsl:apply-templates mode="mal2html.inline.mode"/>
+</xsl:template>
+
+
+<!--**==========================================================================
+mal2html.span
+Renders an inline element as a #{span}
+$node: The element to render
+
+REMARK: Document this template
+-->
+<xsl:template name="mal2html.span">
+ <xsl:param name="node" select="."/>
+ <xsl:param name="class" select="''"/>
+ <span class="{concat($class, ' ', local-name($node))}">
+ <xsl:choose>
+ <xsl:when test="$node/@xref | $node/@href">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="mal.link.target">
+ <xsl:with-param name="link" select="$node"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="title">
+ <xsl:call-template name="mal.link.tooltip">
+ <xsl:with-param name="link" select="$node"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:apply-templates mode="mal2html.inline.content.mode" select="$node"/>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="mal2html.inline.content.mode" select="$node"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </span>
+</xsl:template>
+
+
+
+
+<!--**==========================================================================
+mal2html.inline.css
+Outputs CSS that controls the appearance of inline elements
+
+REMARK: Describe this template
+-->
+<xsl:template name="mal2html.inline.css">
+<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.code { font-family: monospace; }
+span.em { font-style: italic; }
+span.email { color: red; }
+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; }
+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.gray_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.screen span.output {
+ color: </xsl:text>
+ <xsl:value-of select="$theme.color.text_light"/><xsl:text>;
+}
+pre.screen span.output-error {
+<!-- FIXME: theme -->
+ color: #ff0000;
+}
+pre.screen span.output-prompt { font-weight: bold; }
+span.sys { font-family: monospace; }
+span.var { font-style: italic; }
+</xsl:text>
+</xsl:template>
+
+
+<!-- == Matched Templates == -->
+
+<!-- = app = -->
+<xsl:template mode="mal2html.inline.mode" match="mal:app">
+ <xsl:call-template name="mal2html.span"/>
+</xsl:template>
+
+<!-- = cmd = -->
+<xsl:template mode="mal2html.inline.mode" match="mal:cmd">
+ <xsl:call-template name="mal2html.span"/>
+</xsl:template>
+
+<!-- = code = -->
+<xsl:template mode="mal2html.inline.mode" match="mal:code">
+ <xsl:call-template name="mal2html.span"/>
+</xsl:template>
+
+<!-- = date = -->
+<xsl:template mode="mal2html.inline.mode" match="mal:date">
+ <xsl:call-template name="mal2html.span"/>
+</xsl:template>
+
+<!-- = em = -->
+<xsl:template mode="mal2html.inline.mode" match="mal:em">
+ <xsl:call-template name="mal2html.span"/>
+</xsl:template>
+
+<!-- = email = -->
+<xsl:template mode="mal2html.inline.mode" match="mal:email">
+ <xsl:call-template name="mal2html.span"/>
+</xsl:template>
+
+<!-- = file = -->
+<xsl:template mode="mal2html.inline.mode" match="mal:file">
+ <xsl:call-template name="mal2html.span"/>
+</xsl:template>
+
+<!-- = gui = -->
+<xsl:template mode="mal2html.inline.mode" match="mal:gui">
+ <xsl:call-template name="mal2html.span"/>
+</xsl:template>
+
+<!-- = guiseq = -->
+<xsl:template mode="mal2html.inline.mode" match="mal:guiseq">
+ <xsl:call-template name="mal2html.span"/>
+</xsl:template>
+
+<!-- = guiseq % mal2html.inline.content.mode = -->
+<xsl:template mode="mal2html.inline.content.mode" match="mal:guiseq">
+ <xsl:for-each select="mal:gui">
+ <xsl:if test="position() != 1">
+ <!-- FIXME: rtl -->
+ <xsl:text>&#x00A0;&#x25B8; </xsl:text>
+ </xsl:if>
+ <xsl:apply-templates mode="mal2html.inline.mode" select="."/>
+ </xsl:for-each>
+</xsl:template>
+
+<!-- = input = -->
+<xsl:template mode="mal2html.inline.mode" match="mal:input">
+ <xsl:call-template name="mal2html.span"/>
+</xsl:template>
+
+<!-- = key = -->
+<xsl:template mode="mal2html.inline.mode" match="mal:key">
+ <xsl:call-template name="mal2html.span"/>
+</xsl:template>
+
+<!-- = keyseq = -->
+<xsl:template mode="mal2html.inline.mode" match="mal:keyseq">
+ <xsl:call-template name="mal2html.span"/>
+</xsl:template>
+
+<!-- = keyseq % mal2html.inline.content.mode = -->
+<xsl:template mode="mal2html.inline.content.mode" match="mal:keyseq">
+ <xsl:variable name="joinchar">
+ <xsl:choose>
+ <xsl:when test="@type = 'sequence'">
+ <xsl:text> </xsl:text>
+ </xsl:when>
+ <xsl:when test="contains(concat(' ', @style, ' '), ' hyphen ')">
+ <xsl:text>-</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>+</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:for-each select="* | text()[normalize-space(.) != '']">
+ <xsl:if test="position() != 1">
+ <xsl:value-of select="$joinchar"/>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="./self::text()">
+ <xsl:value-of select="normalize-space(.)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="mal2html.inline.mode" select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+</xsl:template>
+
+<!-- = link = -->
+<xsl:template mode="mal2html.inline.mode" match="mal:link">
+ <xsl:call-template name="mal2html.span"/>
+</xsl:template>
+
+<!-- = link % mal2html.inline.content.mode = -->
+<xsl:template mode="mal2html.inline.content.mode" match="mal:link">
+ <xsl:choose>
+ <xsl:when test="normalize-space(.) != ''">
+ <xsl:apply-templates mode="mal2html.inline.mode"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="mal.link.content"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!-- = media = -->
+<xsl:template mode="mal2html.inline.mode" match="mal:media">
+ <!-- FIXME -->
+</xsl:template>
+
+<!-- = name = -->
+<xsl:template mode="mal2html.inline.mode" match="mal:name">
+ <xsl:call-template name="mal2html.span"/>
+</xsl:template>
+
+<!-- = output = -->
+<xsl:template mode="mal2html.inline.mode" match="mal:output">
+ <xsl:variable name="style" select="concat(' ', @style, ' ')"/>
+ <xsl:call-template name="mal2html.span">
+ <xsl:with-param name="class">
+ <xsl:choose>
+ <xsl:when test="contains($style, ' output ')">
+ <xsl:text>output-output</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($style, ' error ')">
+ <xsl:text>output-error</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($style, ' prompt ')">
+ <xsl:text>output-prompt</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- = quote = -->
+<xsl:template mode="mal2html.inline.mode" match="mal:quote">
+ <!-- FIXME: do smart quoting -->
+ <xsl:text>"</xsl:text>
+ <xsl:call-template name="mal2html.span"/>
+ <xsl:text>"</xsl:text>
+</xsl:template>
+
+<!-- = sys = -->
+<xsl:template mode="mal2html.inline.mode" match="mal:sys">
+ <xsl:call-template name="mal2html.span"/>
+</xsl:template>
+
+<!-- = var = -->
+<xsl:template mode="mal2html.inline.mode" match="mal:var">
+ <xsl:call-template name="mal2html.span"/>
+</xsl:template>
+
+<!-- = text() = -->
+<xsl:template mode="mal2html.inline.mode" match="text()">
+ <xsl:value-of select="."/>
+</xsl:template>
+
+<!-- = FIXME = -->
+<xsl:template mode="mal2html.inline.mode" match="*">
+ <xsl:message>
+ <xsl:text>Unmatched inline element: </xsl:text>
+ <xsl:value-of select="local-name(.)"/>
+ </xsl:message>
+ <xsl:apply-templates mode="mal2html.inline.mode"/>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/mallard/html/mal2html-list.xsl b/xslt/mallard/html/mal2html-list.xsl
new file mode 100644
index 0000000..22a54f0
--- /dev/null
+++ b/xslt/mallard/html/mal2html-list.xsl
@@ -0,0 +1,292 @@
+<?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:mal="http://www.gnome.org/~shaunm/mallard"
+ xmlns="http://www.w3.org/1999/xhtml"
+ version="1.0">
+
+<!--!!==========================================================================
+Mallard to HTML - List Elements
+
+REMARK: Describe this module
+-->
+
+
+<!--**==========================================================================
+mal2html.list.css
+Outputs CSS that controls the appearance of lists
+
+REMARK: Describe this template
+-->
+<xsl:template name="mal2html.list.css">
+<xsl:text>
+div.list-contents { margin: 0; padding: 0; }
+div.title-list { margin-bottom: 0.5em; }
+ol.list, ul.list { margin: 0; padding: 0; }
+li.item-list { margin-left: 1.44em; }
+
+div.steps-contents {
+ margin: 0;
+ padding: 0.5em 1em 0.5em 1em;
+ border-top: solid 2px;
+ border-bottom: solid 2px;
+ 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>;
+}
+div.steps-contents div.steps-contents {
+ padding: 0;
+ border: none;
+ background-color: none;
+}
+ol.steps, ul.steps { margin: 0; padding: 0; }
+li.item-steps { margin-left: 1.44em; }
+
+div.terms-contents { margin: 0; }
+dt.item-next { margin-top: 0; }
+dd.item-terms {
+ margin-top: 0.2em;
+ margin-left: 1.44em;
+}
+
+ul.tree {
+ margin: 0; padding: 0;
+ list-style-type: none;
+}
+li.item-tree { margin: 0; padding: 0; }
+div.item-tree { margin: 0; padding: 0; }
+ul.tree ul.tree {
+ margin-left: 1.44em;
+}
+div.tree-lines ul.tree { margin-left: 0; }
+</xsl:text>
+</xsl:template>
+
+
+<!-- = list = -->
+<xsl:template mode="mal2html.block.mode" match="mal:list">
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
+ <xsl:variable name="el">
+ <xsl:choose>
+ <xsl:when test="not(@type) or (@type = 'none') or (@type = 'box')
+ or (@type = 'check') or (@type = 'circle') or (@type = 'diamond')
+ or (@type = 'disc') or (@type = 'hyphen') or (@type = 'square')">
+ <xsl:text>ul</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>ol</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <div>
+ <xsl:attribute name="class">
+ <xsl:text>list</xsl:text>
+ <xsl:if test="$first_child">
+ <xsl:text> first-child</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
+ <div class="list-contents">
+ <xsl:element name="{$el}" namespace="{$mal2html.namespace}">
+ <xsl:attribute name="class">
+ <xsl:text>list</xsl:text>
+ </xsl:attribute>
+ <xsl:if test="@type">
+ <xsl:attribute name="style">
+ <xsl:value-of select="concat('list-style-type:', @type)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="mal2html.list.list.mode" select="mal:item"/>
+ </xsl:element>
+ </div>
+ </div>
+</xsl:template>
+
+<!-- = list/item = -->
+<xsl:template mode="mal2html.list.list.mode" match="mal:item">
+ <li>
+ <xsl:attribute name="class">
+ <xsl:text>item-list</xsl:text>
+ <xsl:if test="not(preceding-sibling::mal:item)">
+ <xsl:text> first-child</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:for-each
+ select="mal:*[
+ ($mal2html.editor_mode or not(self::mal:comment)
+ or processing-instruction('mal2html.show_comment'))]">
+ <xsl:apply-templates mode="mal2html.block.mode" select=".">
+ <xsl:with-param name="first_child" select="position() = 1"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
+ </li>
+</xsl:template>
+
+<!-- = steps = -->
+<xsl:template mode="mal2html.block.mode" match="mal:steps">
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
+ <div>
+ <xsl:attribute name="class">
+ <xsl:text>steps</xsl:text>
+ <xsl:if test="$first_child">
+ <xsl:text> first-child</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
+ <div class="steps-contents">
+ <ol class="steps">
+ <xsl:apply-templates mode="mal2html.list.steps.mode" select="mal:item"/>
+ </ol>
+ </div>
+ </div>
+</xsl:template>
+
+<!-- = steps/item = -->
+<xsl:template mode="mal2html.list.steps.mode" match="mal:item">
+ <li>
+ <xsl:attribute name="class">
+ <xsl:text>item-steps</xsl:text>
+ <xsl:if test="not(preceding-sibling::mal:item)">
+ <xsl:text> first-child</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:for-each
+ select="mal:*[
+ ($mal2html.editor_mode or not(self::mal:comment)
+ or processing-instruction('mal2html.show_comment'))]">
+ <xsl:apply-templates mode="mal2html.block.mode" select=".">
+ <xsl:with-param name="first_child" select="position() = 1"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
+ </li>
+</xsl:template>
+
+<!-- = terms = -->
+<xsl:template mode="mal2html.block.mode" match="mal:terms">
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
+ <div>
+ <xsl:attribute name="class">
+ <xsl:text>terms</xsl:text>
+ <xsl:if test="$first_child">
+ <xsl:text> first-child</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
+ <div class="terms-contents">
+ <dl class="terms">
+ <xsl:apply-templates mode="mal2html.list.terms.mode" select="mal:item"/>
+ </dl>
+ </div>
+ </div>
+</xsl:template>
+
+<!-- = list/item = -->
+<xsl:template mode="mal2html.list.terms.mode" match="mal:item">
+ <xsl:for-each select="mal:title">
+ <dt>
+ <xsl:attribute name="class">
+ <xsl:text>item-terms</xsl:text>
+ <xsl:if test="not(../preceding-sibling::mal:item)">
+ <xsl:text> first-child</xsl:text>
+ </xsl:if>
+ <xsl:if test="preceding-sibling::mal:title">
+ <xsl:text> item-next</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:apply-templates mode="mal2html.inline.mode"/>
+ </dt>
+ </xsl:for-each>
+ <dd class="item-terms">
+ <xsl:for-each
+ select="mal:*[not(self::mal:title)
+ and ($mal2html.editor_mode or not(self::mal:comment)
+ or processing-instruction('mal2html.show_comment'))]">
+ <xsl:apply-templates mode="mal2html.block.mode" select=".">
+ <xsl:with-param name="first_child" select="position() = 1"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
+ </dd>
+</xsl:template>
+
+<!-- = tree = -->
+<xsl:template mode="mal2html.block.mode" match="mal:tree">
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
+ <xsl:variable name="lines" select="contains(concat(' ', @style, ' '), ' lines ')"/>
+ <div>
+ <xsl:attribute name="class">
+ <xsl:text>tree</xsl:text>
+ <xsl:if test="$lines">
+ <xsl:text> tree-lines</xsl:text>
+ </xsl:if>
+ <!-- FIXME -->
+ <xsl:if test="$first_child">
+ <xsl:text> first-child</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <ul class="tree">
+ <xsl:apply-templates mode="mal2html.list.tree.mode" select="mal:item">
+ <xsl:with-param name="lines" select="$lines"/>
+ </xsl:apply-templates>
+ </ul>
+ </div>
+</xsl:template>
+
+<!-- = tree/item = -->
+<xsl:template mode="mal2html.list.tree.mode" match="mal:item">
+ <xsl:param name="lines" select="false()"/>
+ <xsl:param name="prefix" select="''"/>
+ <li class="item-tree">
+ <div class="item-tree">
+ <xsl:if test="$lines">
+ <xsl:value-of select="$prefix"/>
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ <xsl:apply-templates mode="mal2html.inline.mode"
+ select="node()[not(self::mal:item)]"/>
+ </div>
+ <xsl:if test="mal:item">
+ <ul class="tree">
+ <xsl:for-each select="mal:item">
+ <xsl:apply-templates mode="mal2html.list.tree.mode" select=".">
+ <xsl:with-param name="lines" select="$lines"/>
+ <xsl:with-param name="prefix">
+ <xsl:if test="$lines">
+ <xsl:value-of select="translate(
+ translate($prefix, '&#x251C;', '&#x2502;'),
+ '&#x2514;', '&#x202F;')"/>
+ <xsl:text>&#x202F;&#x202F;&#x202F;&#x202F;</xsl:text>
+ <xsl:choose>
+ <xsl:when test="following-sibling::mal:item">
+ <xsl:text>&#x251C;</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>&#x2514;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:with-param>
+ </xsl:apply-templates>
+ </xsl:for-each>
+ </ul>
+ </xsl:if>
+ </li>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/mallard/html/mal2html-media.xsl b/xslt/mallard/html/mal2html-media.xsl
new file mode 100644
index 0000000..20308b5
--- /dev/null
+++ b/xslt/mallard/html/mal2html-media.xsl
@@ -0,0 +1,96 @@
+<?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:mal="http://www.gnome.org/~shaunm/mallard"
+ xmlns="http://www.w3.org/1999/xhtml"
+ version="1.0">
+
+<!--!!==========================================================================
+Mallard to HTML - Media Elements
+
+REMARK: Describe this module
+-->
+
+
+<!-- == Matched Templates == -->
+
+<!-- = mal2html.block.mode % media = -->
+<xsl:template mode="mal2html.block.mode" match="mal:media">
+ <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
+ <xsl:choose>
+ <xsl:when test="@type = 'image'">
+ <div>
+ <xsl:attribute name="class">
+ <xsl:text>media media-image</xsl:text>
+ <xsl:if test="$first_child">
+ <xsl:text> first-child</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <img src="{@src}">
+ <xsl:copy-of select="@height"/>
+ <xsl:copy-of select="@width"/>
+ <xsl:attribute name="alt">
+ <!-- FIXME: This is not ideal. Nested block container elements
+ will introduce lots of garbage whitespace. But then, XML
+ processors are supposed to normalize whitespace in attribute
+ values anyway. Ideally, we'd have a set of modes for text
+ conversion. That'd probably be best handled in a set of
+ mal2text stylesheets.
+ -->
+ <xsl:for-each select="mal:*">
+ <xsl:if test="position() &gt; 1">
+ <xsl:text>&#x000A;</xsl:text>
+ </xsl:if>
+ <xsl:value-of select="string(.)"/>
+ </xsl:for-each>
+ </xsl:attribute>
+ </img>
+ </div>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="mal:*">
+ <xsl:apply-templates mode="db2html.block.mode" select=".">
+ <xsl:with-param name="first_child" select="position() = 1 and $first_child"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!-- = mal2html.inline.mode % media = -->
+<xsl:template mode="mal2html.inline.mode" match="mal:media">
+ <xsl:choose>
+ <xsl:when test="@type = 'image'">
+ <span class="media media-image">
+ <img src="{@src}">
+ <xsl:copy-of select="@height"/>
+ <xsl:copy-of select="@width"/>
+ <xsl:attribute name="alt">
+ <xsl:value-of select="."/>
+ </xsl:attribute>
+ </img>
+ </span>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="db2html.inline.mode"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/mallard/html/mal2html-page.xsl b/xslt/mallard/html/mal2html-page.xsl
new file mode 100644
index 0000000..769119d
--- /dev/null
+++ b/xslt/mallard/html/mal2html-page.xsl
@@ -0,0 +1,616 @@
+<?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:mal="http://www.gnome.org/~shaunm/mallard"
+ xmlns:str="http://exslt.org/strings"
+ xmlns="http://www.w3.org/1999/xhtml"
+ version="1.0">
+
+<!--!!==========================================================================
+Mallard to HTML - Pages
+
+REMARK: Describe this module
+-->
+
+
+<xsl:param name="mal2html.editor_mode" select="false()"/>
+
+
+<!--**==========================================================================
+mal2html.page.copyright
+Outputs the copyright notice at the bottom of a page
+$node: The top-level #{page} element
+
+REMARK: Describe this template
+-->
+<xsl:template name="db2html.page.copyrights">
+ <xsl:param name="node"/>
+ <div class="copyrights">
+ <xsl:for-each select="$node/mal:info/mal:copyright">
+ <div class="copyright">
+ <!-- FIXME: i18n, multi-year, email -->
+ <xsl:value-of select="concat('ยฉ ', mal:year, ' ', mal:name)"/>
+ </div>
+ </xsl:for-each>
+ </div>
+</xsl:template>
+
+
+<!--**==========================================================================
+mal2html.page.pagelinks
+Outputs the automatic links from a guide page or guide section
+$node: The #{page} or #{section} element containing the links
+
+REMARK: Describe this template
+-->
+<xsl:template name="mal2html.page.pagelinks">
+ <xsl:param name="node" select="."/>
+ <xsl:variable name="id">
+ <xsl:choose>
+ <xsl:when test="$node/self::mal:section">
+ <xsl:value-of select="concat($node/ancestor::mal:page[1]/@id, '#', $node/@id)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$node/@id"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="pagelinks"
+ select="$node/mal:info/mal:link[@type = 'topic']"/>
+ <!-- FIXME: // selectors are slow -->
+ <xsl:variable name="guidelinks"
+ select="$mal.cache//*[mal:info/mal:link[@type = 'guide'][@xref = $id]]
+ [not(@id = $pagelinks/@xref)]"/>
+ <xsl:if test="$pagelinks or $guidelinks">
+ <div class="pagelinks">
+ <xsl:choose>
+ <xsl:when test="contains(concat(' ', $node/@style, ' '), ' 2column ')">
+ <xsl:variable name="coltot" select="ceiling(count($pagelinks | $guidelinks) div 2)"/>
+ <table class="twocolumn"><tr>
+ <td class="twocolumnleft">
+ <xsl:for-each select="$pagelinks[position() &lt;= $coltot]">
+ <xsl:variable name="xref" select="@xref"/>
+ <xsl:for-each select="$mal.cache">
+ <xsl:call-template name="mal2html.page.pagelink">
+ <xsl:with-param name="source" select="$node"/>
+ <xsl:with-param name="target" select="key('mal.cache.key', $xref)"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:for-each>
+ <xsl:for-each select="$guidelinks">
+ <xsl:sort select="mal:info/mal:link[@type = 'guide'][@xref = $id]/@weight"
+ data-type="number" order="descending"/>
+ <!-- FIXME: lang -->
+ <xsl:sort select="mal:info/mal:title[@type = 'sort']"
+ data-type="text" order="ascending"/>
+ <xsl:if test="(position() + count($pagelinks)) &lt;= $coltot">
+ <xsl:call-template name="mal2html.page.pagelink">
+ <xsl:with-param name="source" select="$node"/>
+ <xsl:with-param name="target" select="."/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </td>
+ <td class="twocolumnright">
+ <xsl:for-each select="$pagelinks[position() &gt; $coltot]">
+ <xsl:variable name="xref" select="@xref"/>
+ <xsl:for-each select="$mal.cache">
+ <xsl:call-template name="mal2html.page.pagelink">
+ <xsl:with-param name="source" select="$node"/>
+ <xsl:with-param name="target" select="key('mal.cache.key', $xref)"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:for-each>
+ <xsl:for-each select="$guidelinks">
+ <xsl:sort select="mal:info/mal:link[@type = 'guide'][@xref = $id]/@weight"
+ data-type="number" order="descending"/>
+ <!-- FIXME: lang -->
+ <xsl:sort select="mal:info/mal:title[@type = 'sort']"
+ data-type="text" order="ascending"/>
+ <xsl:if test="(position() + count($pagelinks)) &gt; $coltot">
+ <xsl:call-template name="mal2html.page.pagelink">
+ <xsl:with-param name="source" select="$node"/>
+ <xsl:with-param name="target" select="."/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </td>
+ </tr></table>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="$pagelinks">
+ <xsl:variable name="xref" select="@xref"/>
+ <xsl:for-each select="$mal.cache">
+ <xsl:call-template name="mal2html.page.pagelink">
+ <xsl:with-param name="source" select="$node"/>
+ <xsl:with-param name="target" select="key('mal.cache.key', $xref)"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:for-each>
+ <xsl:for-each select="$guidelinks">
+ <xsl:sort select="mal:info/mal:link[@type = 'guide'][@xref = $id]/@weight"
+ data-type="number" order="descending"/>
+ <!-- FIXME: lang -->
+ <xsl:sort select="mal:info/mal:title[@type = 'sort']"
+ data-type="text" order="ascending"/>
+ <xsl:call-template name="mal2html.page.pagelink">
+ <xsl:with-param name="source" select="$node"/>
+ <xsl:with-param name="target" select="."/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
+ </xsl:if>
+</xsl:template>
+
+
+<!--**==========================================================================
+mal2html.page.pagelink
+Outputs an automatic link block from a guide to a page
+$source: The #{page} or #{section} element containing the link
+$target: The element from the cache file of the page being linked to
+
+REMARK: Describe this template
+-->
+<xsl:template name="mal2html.page.pagelink">
+ <xsl:param name="source" select="."/>
+ <xsl:param name="target"/>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="mal.link.target">
+ <xsl:with-param name="link" select="$source"/>
+ <xsl:with-param name="xref" select="$target/@id"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <div class="pagelink">
+ <div class="title">
+ <xsl:call-template name="mal.link.content">
+ <xsl:with-param name="link" select="$source"/>
+ <xsl:with-param name="xref" select="$target/@id"/>
+ </xsl:call-template>
+
+ <xsl:if test="$mal2html.editor_mode">
+ <xsl:variable name="page" select="$target/ancestor-or-self::mal:page[1]"/>
+ <xsl:variable name="date">
+ <xsl:for-each select="$page/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="$page/mal:info/mal:revision[@date = $date][last()]"/>
+ <xsl:if test="$revision/@status != '' and $revision/@status != 'final'">
+ <xsl:text> </xsl:text>
+ <span>
+ <xsl:attribute name="class">
+ <xsl:value-of select="concat('status status-', $revision/@status)"/>
+ </xsl:attribute>
+ <!-- FIXME: i18n -->
+ <xsl:choose>
+ <xsl:when test="$revision/@status = 'stub'">
+ <xsl:text>Stub</xsl:text>
+ </xsl:when>
+ <xsl:when test="$revision/@status = 'incomplete'">
+ <xsl:text>Incomplete</xsl:text>
+ </xsl:when>
+ <xsl:when test="$revision/@status = 'draft'">
+ <xsl:text>Draft</xsl:text>
+ </xsl:when>
+ <xsl:when test="$revision/@status = 'review'">
+ <xsl:text>Ready for review</xsl:text>
+ </xsl:when>
+ <xsl:when test="$revision/@status = 'final'">
+ <xsl:text>Final</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </span>
+ </xsl:if>
+ </xsl:if>
+ </div>
+ <xsl:if test="$target/mal:info/mal:desc">
+ <div class="desc">
+ <xsl:apply-templates mode="mal2html.inline.mode"
+ select="$target/mal:info/mal:desc[1]/node()"/>
+ </div>
+ </xsl:if>
+ </div>
+ </a>
+</xsl:template>
+
+
+<!--**==========================================================================
+mal2html.page.autolinks
+Outputs the automatic links from a page to related pages
+$node: The #{topic} or #{section} element containing the links
+
+REMARK: Describe this template
+-->
+<xsl:template name="mal2html.page.autolinks">
+ <xsl:param name="node" select="."/>
+ <xsl:variable name="depth"
+ select="count($node/ancestor::mal:section) + 2"/>
+ <xsl:variable name="id">
+ <xsl:choose>
+ <xsl:when test="$node/self::mal:section">
+ <xsl:value-of select="concat($node/ancestor::mal:page[1]/@id, '#', $node/@id)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$node/@id"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- FIXME: // is slow -->
+ <xsl:variable name="inlinks"
+ select="$mal.cache//*[mal:info/mal:link[@type = 'seealso'][@xref = $id]]"/>
+ <xsl:variable name="outlinks"
+ select="$node/mal:info/mal:link[@type = 'seealso']"/>
+ <xsl:variable name="pagelinks"
+ select="$mal.cache//*[mal:info/mal:link[@type = 'topic'][@xref = $id]]"/>
+ <xsl:variable name="guidelinks"
+ select="$node/mal:info/mal:link[@type = 'guide']"/>
+ <xsl:if test="$inlinks or $outlinks or $pagelinks or $guidelinks">
+ <div class="section autolinkssection">
+ <div class="header">
+ <xsl:element name="{concat('h', $depth)}" namespace="{$mal2html.namespace}">
+ <xsl:attribute name="class">
+ <xsl:text>title</xsl:text>
+ </xsl:attribute>
+ <!-- FIXME: i18n -->
+ <xsl:text>Further Reading</xsl:text>
+ </xsl:element>
+ </div>
+ <div class="autolinks">
+ <xsl:if test="$pagelinks or $guidelinks">
+ <div class="title"><span>
+ <!-- FIXME: i18n -->
+ <xsl:text>More About</xsl:text>
+ </span></div>
+ <ul>
+ <xsl:for-each select="$pagelinks">
+ <xsl:call-template name="mal2html.page.autolink">
+ <xsl:with-param name="page" select="."/>
+ </xsl:call-template>
+ </xsl:for-each>
+ <!-- FIXME: exclude pagelinks -->
+ <xsl:for-each select="$guidelinks">
+ <xsl:call-template name="mal2html.page.autolink">
+ <xsl:with-param name="xref" select="@xref"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </ul>
+ </xsl:if>
+
+ <xsl:if test="$inlinks or $outlinks">
+ <div class="title"><span>
+ <!-- FIXME: i18n -->
+ <xsl:text>See Also</xsl:text>
+ </span></div>
+ <ul>
+ <xsl:for-each select="$inlinks">
+ <xsl:call-template name="mal2html.page.autolink">
+ <xsl:with-param name="page" select="."/>
+ </xsl:call-template>
+ </xsl:for-each>
+ <xsl:for-each select="$outlinks">
+ <xsl:call-template name="mal2html.page.autolink">
+ <xsl:with-param name="xref" select="@xref"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </ul>
+ </xsl:if>
+ </div>
+ </div>
+ </xsl:if>
+</xsl:template>
+
+
+<!--**==========================================================================
+mal2html.page.autolink
+Outputs an automatic link for a related page
+$page: The element from the cache file of the page being linked to
+
+REMARK: Describe this template
+-->
+<xsl:template name="mal2html.page.autolink">
+ <xsl:param name="page"/>
+ <xsl:param name="xref" select="$page/@id"/>
+ <li class="autolink">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="mal.link.target">
+ <xsl:with-param name="xref" select="$xref"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:call-template name="mal.link.content">
+ <xsl:with-param name="node" select="."/>
+ <xsl:with-param name="xref" select="$xref"/>
+ </xsl:call-template>
+ </a>
+ <xsl:for-each select="$mal.cache">
+ <xsl:variable name="desc" select="key('mal.cache.key', $xref)/mal:info/mal:desc"/>
+ <xsl:if test="$desc">
+ <span class="desc">
+ <xsl:text> &#x2014; </xsl:text>
+ <xsl:apply-templates mode="mal2html.inline.mode" select="$desc/node()"/>
+ </span>
+ </xsl:if>
+ </xsl:for-each>
+ </li>
+</xsl:template>
+
+
+<!--**==========================================================================
+mal2html.page.linktrails
+FIXME
+
+REMARK: Describe this template
+-->
+<xsl:template name="mal2html.page.linktrails">
+ <xsl:param name="node" select="."/>
+ <xsl:param name="id">
+ <xsl:choose>
+ <xsl:when test="$node/self::mal:page or contains($node/@id, '#')">
+ <xsl:value-of select="$node/@id"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$node/ancestor::mal:page/@id"/>
+ <xsl:text>#</xsl:text>
+ <xsl:value-of select="$node/@id"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:param>
+ <xsl:param name="trailid" select="$id"/>
+ <xsl:param name="trail" select="''"/>
+ <xsl:variable name="traillist" select="str:split($trail, ':')"/>
+ <xsl:if test="count($traillist) &lt; 5">
+ <xsl:choose>
+ <xsl:when test="$id = 'index'">
+ <xsl:if test="$trail != ''">
+ <xsl:variable name="fulltrail"
+ select="str:split(concat($trailid, $trail), ':')"/>
+ <div class="linktrail">
+ <xsl:for-each select="$fulltrail">
+ <a class="linktrail">
+ <xsl:attribute name="href">
+ <xsl:call-template name="mal.link.target">
+ <xsl:with-param name="xref" select="."/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:call-template name="mal.link.content">
+ <xsl:with-param name="xref" select="."/>
+ </xsl:call-template>
+ </a>
+ <xsl:text> ยป </xsl:text>
+ </xsl:for-each>
+ </div>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="guidelinks"
+ select="$node/mal:info/mal:link[@type = 'guide']"/>
+ <xsl:variable name="pagelinks"
+ select="$mal.cache//*[mal:info/mal:link[@type = 'topic'][@xref = $id]]"/>
+ <xsl:if test="not($guidelinks or $pagelinks) and $node/self::mal:section">
+ <xsl:call-template name="mal2html.page.linktrails">
+ <xsl:with-param name="node" select="$node/ancestor::mal:page"/>
+ <xsl:with-param name="trailid" select="$trailid"/>
+ <xsl:with-param name="trail" select="$trail"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:variable name="newtrail">
+ <xsl:choose>
+ <xsl:when test="$trail = ''">
+ <xsl:text>:</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat(':', $trailid, $trail)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:for-each select="$guidelinks">
+ <xsl:variable name="fullid">
+ <xsl:choose>
+ <xsl:when test="contains(@xref, '#')">
+ <xsl:variable name="pageid" select="substring-before(@xref, '#')"/>
+ <xsl:variable name="sectionid" select="substring-after(@xref, '#')"/>
+ <xsl:if test="$pageid = ''">
+ <xsl:value-of select="ancestor::mal:page/@id"/>
+ </xsl:if>
+ <xsl:value-of select="concat($pageid, '#', $sectionid)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@xref"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:for-each select="$mal.cache">
+ <xsl:call-template name="mal2html.page.linktrails">
+ <xsl:with-param name="node" select="key('mal.cache.key', $fullid)"/>
+ <xsl:with-param name="trail" select="$newtrail"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:for-each>
+ <xsl:for-each select="$pagelinks">
+ <xsl:call-template name="mal2html.page.linktrails">
+ <xsl:with-param name="node" select="."/>
+ <xsl:with-param name="trail" select="$newtrail"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+</xsl:template>
+
+
+<!-- == Matched Templates == -->
+
+<!-- = / = -->
+<xsl:template match="/">
+ <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>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="mal.chunk.content.mode" select="mal:page"/>
+ </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:value-of select="mal:title"/>
+ </title>
+ <xsl:call-template name="mal2html.css"/>
+ </head>
+ <body>
+ <div class="head">
+ <xsl:call-template name="mal2html.page.linktrails">
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ </div>
+ <div class="body">
+ <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:text>Stub</xsl:text>
+ </xsl:when>
+ <xsl:when test="$revision/@status = 'incomplete'">
+ <xsl:text>Incomplete</xsl:text>
+ </xsl:when>
+ <xsl:when test="$revision/@status = 'draft'">
+ <xsl:text>Draft</xsl:text>
+ </xsl:when>
+ <xsl:when test="$revision/@status = 'review'">
+ <xsl:text>Ready for review</xsl:text>
+ </xsl:when>
+ <xsl:when test="$revision/@status = 'final'">
+ <xsl:text>Final</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </div>
+ <p class="version">
+ <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="db2html.page.copyrights">
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ </body>
+ </html>
+</xsl:template>
+
+<!-- = page = -->
+<xsl:template match="mal:page">
+ <div class="header">
+ <xsl:apply-templates mode="mal2html.title.mode" select="mal:title"/>
+ <xsl:apply-templates mode="mal2html.title.mode" select="mal:subtitle"/>
+ </div>
+ <div class="contents">
+ <xsl:for-each
+ select="mal:*[not(self::mal:section or self::mal:title or self::mal:subtitle)
+ and ($mal2html.editor_mode or not(self::mal:comment)
+ or processing-instruction('mal2html.show_comment'))]">
+ <xsl:apply-templates mode="mal2html.block.mode" select=".">
+ <xsl:with-param name="first_child" select="position() = 1"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
+ <xsl:if test="@type = 'guide'">
+ <xsl:call-template name="mal2html.page.pagelinks"/>
+ </xsl:if>
+ </div>
+ <xsl:apply-templates select="mal:section"/>
+ <xsl:call-template name="mal2html.page.autolinks">
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- = section = -->
+<xsl:template match="mal:section">
+ <div class="section" id="{@id}">
+ <div class="header">
+ <xsl:apply-templates mode="mal2html.title.mode" select="mal:title"/>
+ <xsl:apply-templates mode="mal2html.title.mode" select="mal:subtitle"/>
+ </div>
+ <div class="contents">
+ <xsl:for-each
+ select="mal:*[not(self::mal:section or self::mal:title or self::mal:subtitle)
+ and ($mal2html.editor_mode or not(self::mal:comment)
+ or processing-instruction('mal2html.show_comment'))]">
+ <xsl:apply-templates mode="mal2html.block.mode" select=".">
+ <xsl:with-param name="first_child" select="position() = 1"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
+ <xsl:if test="/mal:page/@type = 'guide'">
+ <xsl:call-template name="mal2html.page.pagelinks"/>
+ </xsl:if>
+ </div>
+ <xsl:apply-templates select="mal:section"/>
+ <xsl:call-template name="mal2html.page.autolinks">
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ </div>
+</xsl:template>
+
+<!-- = subtitle = -->
+<xsl:template mode="mal2html.title.mode" match="mal:subtitle">
+ <!-- FIXME -->
+</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>
+ <xsl:apply-templates mode="mal2html.inline.mode"/>
+ </xsl:element>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/mallard/html/mal2html-table.xsl b/xslt/mallard/html/mal2html-table.xsl
new file mode 100644
index 0000000..da86a28
--- /dev/null
+++ b/xslt/mallard/html/mal2html-table.xsl
@@ -0,0 +1,424 @@
+<?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:mal="http://www.gnome.org/~shaunm/mallard"
+ xmlns:str="http://exslt.org/strings"
+ xmlns="http://www.w3.org/1999/xhtml"
+ extension-element-prefixes="str"
+ version="1.0">
+
+<!--!!==========================================================================
+Mallard to HTML - Table Elements
+
+REMARK: Describe this module
+-->
+
+
+<!--**==========================================================================
+mal2html.table.css
+Outputs CSS that controls the appearance of tables
+
+REMARK: Describe this template
+-->
+<xsl:template name="mal2html.table.css">
+<xsl:text>
+table.table {
+ border-collapse: collapse;
+ border-color: #555753;
+ border-width: 1px;
+}
+table.table td {
+ padding: 0.1em 0.5em 0.1em 0.5em;
+ border-color: #888a85;
+ border-width: 1px;
+ vertical-align: top;
+}
+</xsl:text>
+</xsl:template>
+
+
+<!-- == Matched Templates == -->
+
+<!-- = table = -->
+<xsl:template mode="mal2html.block.mode" match="mal:table">
+ <xsl:variable name="cols" select="mal:col | mal:colgroup/mal:col"/>
+ <xsl:variable name="style">
+ <xsl:if test="@frame and @frame != 'none'">
+ <xsl:choose>
+ <xsl:when test="@frame = 'all'">
+ <xsl:text>border-style: solid;</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="str:split(@frame)">
+ <xsl:choose>
+ <xsl:when test=". = 'top'">
+ <xsl:text>border-top-style: solid;</xsl:text>
+ </xsl:when>
+ <xsl:when test=". = 'bottom'">
+ <xsl:text>border-bottom-style: solid;</xsl:text>
+ </xsl:when>
+ <xsl:when test=". = 'left'">
+ <xsl:text>border-left-style: solid;</xsl:text>
+ </xsl:when>
+ <xsl:when test=". = 'right'">
+ <xsl:text>border-right-style: solid;</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="rowrules">
+ <xsl:choose>
+ <xsl:when test="not(@rules) or @rules = 'none'">
+ <xsl:text>none</xsl:text>
+ </xsl:when>
+ <xsl:when test="@rules = 'all'">
+ <xsl:text>all</xsl:text>
+ </xsl:when>
+ <xsl:when test="@rules = 'groups'">
+ <xsl:text>groups</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="str:split(@rules)">
+ <xsl:choose>
+ <xsl:when test=". = 'rows'">
+ <xsl:text>all</xsl:text>
+ </xsl:when>
+ <xsl:when test=". = 'rowgroups'">
+ <xsl:text>groups</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="colrules">
+ <xsl:choose>
+ <xsl:when test="not(@rules) or @rules = 'none'">
+ <xsl:text>none</xsl:text>
+ </xsl:when>
+ <xsl:when test="@rules = 'all'">
+ <xsl:text>all</xsl:text>
+ </xsl:when>
+ <xsl:when test="@rules = 'groups'">
+ <xsl:text>groups</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="str:split(@rules)">
+ <xsl:choose>
+ <xsl:when test=". = 'cols'">
+ <xsl:text>all</xsl:text>
+ </xsl:when>
+ <xsl:when test=". = 'colgroups'">
+ <xsl:text>groups</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="rowshade">
+ <xsl:choose>
+ <xsl:when test="not(@shade) or @shade = 'none'">
+ <xsl:text>none</xsl:text>
+ </xsl:when>
+ <xsl:when test="@shade = 'all'">
+ <xsl:text>all</xsl:text>
+ </xsl:when>
+ <xsl:when test="@shade = 'groups'">
+ <xsl:text>groups</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="str:split(@shade)">
+ <xsl:choose>
+ <xsl:when test=". = 'rows'">
+ <xsl:text>all</xsl:text>
+ </xsl:when>
+ <xsl:when test=". = 'rowgroups'">
+ <xsl:text>groups</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="colshade">
+ <xsl:choose>
+ <xsl:when test="not(@shade) or @shade = 'none'">
+ <xsl:text>none</xsl:text>
+ </xsl:when>
+ <xsl:when test="@shade = 'all'">
+ <xsl:text>all</xsl:text>
+ </xsl:when>
+ <xsl:when test="@shade = 'groups'">
+ <xsl:text>groups</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="str:split(@shade)">
+ <xsl:choose>
+ <xsl:when test=". = 'cols'">
+ <xsl:text>all</xsl:text>
+ </xsl:when>
+ <xsl:when test=". = 'colgroups'">
+ <xsl:text>groups</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <div>
+ <xsl:attribute name="class">
+ <xsl:text>table</xsl:text>
+ <xsl:if test="not(preceding-sibling::*)">
+ <xsl:text> first-child</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <table class="table">
+ <xsl:if test="$style != ''">
+ <xsl:attribute name="style">
+ <xsl:value-of select="$style"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="mal:thead">
+ <xsl:with-param name="cols" select="$cols"/>
+ <xsl:with-param name="rowrules" select="$rowrules"/>
+ <xsl:with-param name="colrules" select="$colrules"/>
+ <xsl:with-param name="rowshade" select="$rowshade"/>
+ <xsl:with-param name="colshade" select="$colshade"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="mal:tfoot">
+ <xsl:with-param name="cols" select="$cols"/>
+ <xsl:with-param name="rowrules" select="$rowrules"/>
+ <xsl:with-param name="colrules" select="$colrules"/>
+ <xsl:with-param name="rowshade" select="$rowshade"/>
+ <xsl:with-param name="colshade" select="$colshade"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="mal:tr | mal:tbody">
+ <xsl:with-param name="cols" select="$cols"/>
+ <xsl:with-param name="rowrules" select="$rowrules"/>
+ <xsl:with-param name="colrules" select="$colrules"/>
+ <xsl:with-param name="rowshade" select="$rowshade"/>
+ <xsl:with-param name="colshade" select="$colshade"/>
+ </xsl:apply-templates>
+ </table>
+ </div>
+</xsl:template>
+
+<!-- = tbody = -->
+<xsl:template match="mal:tbody">
+ <xsl:param name="cols"/>
+ <xsl:param name="rowrules"/>
+ <xsl:param name="colrules"/>
+ <xsl:param name="rowshade"/>
+ <xsl:param name="colshade"/>
+ <tbody>
+ <xsl:apply-templates select="mal:tr">
+ <xsl:with-param name="cols" select="$cols"/>
+ <xsl:with-param name="rowrules" select="$rowrules"/>
+ <xsl:with-param name="colrules" select="$colrules"/>
+ <xsl:with-param name="rowshade" select="$rowshade"/>
+ <xsl:with-param name="colshade" select="$colshade"/>
+ </xsl:apply-templates>
+ </tbody>
+</xsl:template>
+
+<!-- = thead = -->
+<xsl:template match="mal:thead">
+ <xsl:param name="cols"/>
+ <xsl:param name="rowrules"/>
+ <xsl:param name="colrules"/>
+ <xsl:param name="rowshade"/>
+ <xsl:param name="colshade"/>
+ <thead>
+ <xsl:apply-templates select="mal:tr">
+ <xsl:with-param name="cols" select="$cols"/>
+ <xsl:with-param name="rowrules" select="$rowrules"/>
+ <xsl:with-param name="colrules" select="$colrules"/>
+ <xsl:with-param name="rowshade" select="$rowshade"/>
+ <xsl:with-param name="colshade" select="$colshade"/>
+ </xsl:apply-templates>
+ </thead>
+</xsl:template>
+
+<!-- = tfoot = -->
+<xsl:template match="mal:tfoot">
+ <xsl:param name="cols"/>
+ <xsl:param name="rowrules"/>
+ <xsl:param name="colrules"/>
+ <xsl:param name="rowshade"/>
+ <xsl:param name="colshade"/>
+ <tfoot>
+ <xsl:apply-templates select="mal:tr">
+ <xsl:with-param name="cols" select="$cols"/>
+ <xsl:with-param name="rowrules" select="$rowrules"/>
+ <xsl:with-param name="colrules" select="$colrules"/>
+ <xsl:with-param name="rowshade" select="$rowshade"/>
+ <xsl:with-param name="colshade" select="$colshade"/>
+ </xsl:apply-templates>
+ </tfoot>
+</xsl:template>
+
+<!-- = tr = -->
+<xsl:template match="mal:tr">
+ <xsl:param name="cols"/>
+ <xsl:param name="rowrules"/>
+ <xsl:param name="colrules"/>
+ <xsl:param name="rowshade"/>
+ <xsl:param name="colshade"/>
+ <tr>
+ <xsl:apply-templates select="mal:td">
+ <xsl:with-param name="cols" select="$cols"/>
+ <xsl:with-param name="rowrules" select="$rowrules"/>
+ <xsl:with-param name="colrules" select="$colrules"/>
+ <xsl:with-param name="rowshade" select="$rowshade"/>
+ <xsl:with-param name="colshade" select="$colshade"/>
+ </xsl:apply-templates>
+ </tr>
+</xsl:template>
+
+<!-- = td = -->
+<xsl:template match="mal:td">
+ <xsl:param name="cols"/>
+ <xsl:param name="rowrules"/>
+ <xsl:param name="colrules"/>
+ <xsl:param name="rowshade"/>
+ <xsl:param name="colshade"/>
+ <xsl:variable name="trpos" select="count(../preceding-sibling::mal:tr) + 1"/>
+ <xsl:variable name="tdpos" select="count(preceding-sibling::mal:td) + 1"/>
+ <!-- FIXME: this all breaks with rowspan/colspan -->
+ <xsl:variable name="shaderow">
+ <xsl:choose>
+ <xsl:when test="$rowshade = 'all'">
+ <xsl:choose>
+ <xsl:when test="../../self::mal:table">
+ <xsl:value-of select="($trpos + 1) mod 2"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="bodies"
+ select="../../preceding-sibling::mal:tbody |
+ ../../preceding-sibling::mal:thead "/>
+ <xsl:variable name="trcount" select="count($bodies/mal:tr) + $trpos"/>
+ <xsl:value-of select="($trcount + 1) mod 2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$rowshade = 'groups'">
+ <xsl:variable name="bodies"
+ select="../../preceding-sibling::mal:tbody |
+ ../../preceding-sibling::mal:thead "/>
+ <xsl:value-of select="count($bodies) mod 2"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="shadecol">
+ <xsl:choose>
+ <xsl:when test="$colshade = 'all'">
+ <xsl:value-of select="($tdpos + 1) mod 2"/>
+ </xsl:when>
+ <xsl:when test="$colshade = 'groups'">
+ <xsl:if test="count($cols) &gt;= $tdpos">
+ <xsl:variable name="col" select="$cols[$tdpos]"/>
+ <xsl:if test="$col/../self::mal:colgroup">
+ <xsl:value-of
+ select="count($col/../preceding-sibling::mal:colgroup) mod 2"/>
+ </xsl:if>
+ </xsl:if>
+ <!-- FIXME -->
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="style">
+ <xsl:choose>
+ <xsl:when test="$rowrules = 'all'">
+ <xsl:choose>
+ <xsl:when test="../../self::mal:table">
+ <xsl:if test="$trpos != 1">
+ <xsl:text>border-top-style: solid;</xsl:text>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="$trpos != 1 or
+ ../../preceding-sibling::mal:thead or
+ ../../preceding-sibling::mal:tbody ">
+ <xsl:text>border-top-style: solid;</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$rowrules = 'groups'">
+ <xsl:if test="$trpos = 1">
+ <xsl:choose>
+ <xsl:when test="../../self::mal:tbody">
+ <xsl:if test="../../../mal:thead | ../../preceding-sibling::mal:tbody">
+ <xsl:text>border-top-style: solid;</xsl:text>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="../../self::mal:tfoot">
+ <xsl:text>border-top-style: solid;</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$tdpos = 1"/>
+ <xsl:when test="$colrules = 'all'">
+ <xsl:text>border-left-style: solid;</xsl:text>
+ </xsl:when>
+ <xsl:when test="$colrules = 'groups'">
+ <xsl:if test="count($cols) &gt;= $tdpos">
+ <xsl:variable name="col" select="$cols[$tdpos]"/>
+ <xsl:if test="$col/../self::mal:colgroup and
+ not($col/preceding-sibling::mal:col)">
+ <xsl:text>border-left-style: solid;</xsl:text>
+ </xsl:if>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$shaderow = 1 and $shadecol = 1">
+ <xsl:text>background-color: #d3d7cf;</xsl:text>
+ </xsl:when>
+ <xsl:when test="$shaderow = 1 or $shadecol = 1">
+ <xsl:text>background-color: #eeeeec;</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <td>
+ <xsl:if test="$style != ''">
+ <xsl:attribute name="style">
+ <xsl:value-of select="$style"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@colspan">
+ <xsl:attribute name="colspan">
+ <xsl:value-of select="@colspan"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@rowspan">
+ <xsl:attribute name="rowspan">
+ <xsl:value-of select="@rowspan"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="mal2html.block.mode"/>
+ </td>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/mallard/html/mal2html.xsl b/xslt/mallard/html/mal2html.xsl
new file mode 100644
index 0000000..7952520
--- /dev/null
+++ b/xslt/mallard/html/mal2html.xsl
@@ -0,0 +1,82 @@
+<?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:mal="http://www.gnome.org/~shaunm/mallard"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ exclude-result-prefixes="mal"
+ 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="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-table.xsl"/>
+
+<xsl:include href="../../common/theme.xsl"/>
+<xsl:include href="../../common/utils.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>
+
+<!-- FIXME -->
+<xsl:template name="l10n.gettext">
+ <xsl:param name="msgid" select="'email.tooltip'"/>
+ <xsl:value-of select="$msgid"/>
+</xsl:template>
+<xsl:template name="l10n.direction">
+ <xsl:text>ltr</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/mallard/html/mal2xhtml.xsl b/xslt/mallard/html/mal2xhtml.xsl
new file mode 100644
index 0000000..4cca1b7
--- /dev/null
+++ b/xslt/mallard/html/mal2xhtml.xsl
@@ -0,0 +1,81 @@
+<?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:mal="http://www.gnome.org/~shaunm/mallard"
+ xmlns="http://www.w3.org/1999/xhtml"
+ exclude-result-prefixes="mal"
+ 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
+
+REMARK: Describe this module
+-->
+
+<xsl:include href="../common/mal-chunk.xsl"/>
+<xsl:include href="../common/mal-link.xsl"/>
+
+<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-table.xsl"/>
+
+<xsl:include href="../../common/theme.xsl"/>
+<xsl:include href="../../common/utils.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>
+
+<!-- FIXME -->
+<xsl:template name="l10n.gettext">
+ <xsl:param name="msgid" select="'email.tooltip'"/>
+ <xsl:value-of select="$msgid"/>
+</xsl:template>
+<xsl:template name="l10n.direction">
+ <xsl:text>ltr</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/mallard/utils/Makefile.am b/xslt/mallard/utils/Makefile.am
new file mode 100644
index 0000000..e25066a
--- /dev/null
+++ b/xslt/mallard/utils/Makefile.am
@@ -0,0 +1,5 @@
+xsldir=$(datadir)/xml/gnome/xslt/mallard/utils
+
+xsl_DATA = mal2cache.xsl
+
+EXTRA_DIST=$(xsl_DATA)
diff --git a/xslt/mallard/utils/mal2cache.xsl b/xslt/mallard/utils/mal2cache.xsl
new file mode 100644
index 0000000..86ba254
--- /dev/null
+++ b/xslt/mallard/utils/mal2cache.xsl
@@ -0,0 +1,119 @@
+<?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:mal='http://www.gnome.org/~shaunm/mallard'
+ xmlns='http://www.gnome.org/~shaunm/mallard'
+ version='1.0'>
+
+<xsl:output omit-xml-declaration="yes"/>
+
+<xsl:template match='/mal:cache'>
+ <cache>
+ <xsl:for-each select="mal:page">
+ <xsl:apply-templates select="document(@href)/*">
+ <xsl:with-param name="href" select="@href"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
+ </cache>
+</xsl:template>
+
+<xsl:template match="mal:page">
+ <xsl:param name="href"/>
+ <page>
+ <xsl:attribute name="id">
+ <xsl:value-of select="@id"/>
+ </xsl:attribute>
+ <xsl:attribute name="href">
+ <xsl:value-of select="$href"/>
+ </xsl:attribute>
+ <xsl:if test="@type">
+ <xsl:attribute name="type">
+ <xsl:value-of select="@type"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(mal:info)">
+ <xsl:call-template name="info">
+ <xsl:with-param name="info" select="mal:info"/>
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:apply-templates/>
+ </page>
+</xsl:template>
+
+<xsl:template match="mal:section">
+ <section>
+ <xsl:if test="@id">
+ <xsl:attribute name="id">
+ <xsl:value-of select="ancestor::mal:page[1]/@id"/>
+ <xsl:text>#</xsl:text>
+ <xsl:value-of select="@id"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(mal:info)">
+ <xsl:call-template name="info">
+ <xsl:with-param name="info" select="mal:info"/>
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:apply-templates/>
+ </section>
+</xsl:template>
+
+<xsl:template match="mal:title">
+ <xsl:copy-of select="."/>
+</xsl:template>
+
+<xsl:template name="info" match="mal:info">
+ <xsl:param name="info" select="."/>
+ <xsl:param name="node" select="$info/.."/>
+ <info>
+ <xsl:if test="not($info/mal:title[@type = 'link'])">
+ <title type="link">
+ <xsl:copy-of select="$node/mal:title/node()"/>
+ </title>
+ </xsl:if>
+ <xsl:if test="not($info/mal:title[@type = 'sort'])">
+ <title type="sort">
+ <xsl:choose>
+ <xsl:when test="$info/mal:title[@type = 'link']">
+ <xsl:copy-of select="$info/mal:title[@type = 'link'][1]/node()"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="$node/mal:title/node()"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </title>
+ </xsl:if>
+ <xsl:for-each select="$info/*">
+ <xsl:choose>
+ <xsl:when test="self::mal:link[@type = 'guide' and not(@weight)]">
+ <link type="guide" xref="{@xref}" weight="0"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </info>
+</xsl:template>
+
+<xsl:template match="node() | text()"/>
+
+</xsl:stylesheet>