[yelp-xsl] dita2html-table: Implemented simpletable
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp-xsl] dita2html-table: Implemented simpletable
- Date: Sat, 6 Oct 2012 02:12:38 +0000 (UTC)
commit 575872bc54ea42e9bd99f80d1456f27114a2d1a2
Author: Shaun McCance <shaunm gnome org>
Date: Fri Oct 5 22:12:13 2012 -0400
dita2html-table: Implemented simpletable
xslt/dita/common/dita-selectors.mod | 20 +++++++
xslt/dita/html/dita2html-table.xsl | 94 +++++++++++++++++++++++++++++++++++
xslt/dita/html/dita2html-topic.xsl | 4 ++
xslt/dita/html/dita2xhtml.xsl | 1 +
4 files changed, 119 insertions(+), 0 deletions(-)
---
diff --git a/xslt/dita/common/dita-selectors.mod b/xslt/dita/common/dita-selectors.mod
index 400ba5d..fe5f8ab 100644
--- a/xslt/dita/common/dita-selectors.mod
+++ b/xslt/dita/common/dita-selectors.mod
@@ -243,6 +243,26 @@ topic/shortdesc
<!ENTITY topic_shortdesc "*[name(.) = 'shortdesc' or starts-with(@class, '- topic/shortdesc ')]">
<!-- ===========================================================================
+topic/simpletable
+-->
+<!ENTITY topic_simpletable "*[name(.) = 'simpletable' or starts-with(@class, '- topic/simpletable ')]">
+
+<!-- ===========================================================================
+topic/stentry
+-->
+<!ENTITY topic_stentry "*[name(.) = 'stentry' or starts-with(@class, '- topic/stentry ')]">
+
+<!-- ===========================================================================
+topic/sthead
+-->
+<!ENTITY topic_sthead "*[name(.) = 'sthead' or starts-with(@class, '- topic/sthead ')]">
+
+<!-- ===========================================================================
+topic/strow
+-->
+<!ENTITY topic_strow "*[name(.) = 'strow' or starts-with(@class, '- topic/strow ')]">
+
+<!-- ===========================================================================
topic/text
-->
<!ENTITY topic_text "*[name(.) = 'text' or starts-with(@class, '- topic/text ')]">
diff --git a/xslt/dita/html/dita2html-table.xsl b/xslt/dita/html/dita2html-table.xsl
new file mode 100644
index 0000000..ac08ca9
--- /dev/null
+++ b/xslt/dita/html/dita2html-table.xsl
@@ -0,0 +1,94 @@
+<?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.
+-->
+<!DOCTYPE xsl:stylesheet [
+<!ENTITY % selectors SYSTEM "../common/dita-selectors.mod">
+%selectors;
+]>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:yelp="http://projects.gnome.org/yelp/"
+ xmlns="http://www.w3.org/1999/xhtml"
+ exclude-result-prefixes="yelp"
+ version="1.0">
+
+<!--!!==========================================================================
+DITA to HTML - Tables
+
+REMARK: Describe this module
+-->
+
+
+<!-- = simpletable = -->
+<xsl:template mode="dita2html.topic.mode" match="&topic_simpletable;">
+ <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
+ <xsl:variable name="keycol" select="@keycol"/>
+ <div class="table">
+ <xsl:copy-of select="@id"/>
+ <xsl:call-template name="html.lang.attrs"/>
+ <table class="table">
+ <xsl:for-each select="$conref/&topic_sthead;[1]">
+ <thead>
+ <xsl:call-template name="dita2html.table.simpletable.row">
+ <xsl:with-param name="keycol" select="$keycol"/>
+ </xsl:call-template>
+ </thead>
+ </xsl:for-each>
+ <tbody>
+ <xsl:for-each select="$conref/&topic_strow;">
+ <xsl:call-template name="dita2html.table.simpletable.row">
+ <xsl:with-param name="keycol" select="$keycol"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </tbody>
+ </table>
+ </div>
+</xsl:template>
+
+<xsl:template name="dita2html.table.simpletable.row">
+ <xsl:param name="node" select="."/>
+ <xsl:param name="keycol"/>
+ <xsl:variable name="conref" select="yelp:dita.ref.conref($node)"/>
+ <tr>
+ <xsl:copy-of select="$node/@id"/>
+ <xsl:call-template name="html.lang.attrs">
+ <xsl:with-param name="node" select="$node"/>
+ </xsl:call-template>
+ <xsl:for-each select="$conref/&topic_stentry;">
+ <xsl:choose>
+ <xsl:when test="position() = $keycol or $node[self::&topic_sthead;]">
+ <th>
+ <xsl:copy-of select="@id"/>
+ <xsl:call-template name="html.lang.attrs"/>
+ <xsl:apply-templates mode="dita2html.topic.mode"
+ select="yelp:dita.ref.conref(.)/node()"/>
+ </th>
+ </xsl:when>
+ <xsl:otherwise>
+ <td>
+ <xsl:copy-of select="@id"/>
+ <xsl:call-template name="html.lang.attrs"/>
+ <xsl:apply-templates mode="dita2html.topic.mode"
+ select="yelp:dita.ref.conref(.)/node()"/>
+ </td>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </tr>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/dita/html/dita2html-topic.xsl b/xslt/dita/html/dita2html-topic.xsl
index dccdcdc..3dde5c6 100644
--- a/xslt/dita/html/dita2html-topic.xsl
+++ b/xslt/dita/html/dita2html-topic.xsl
@@ -91,8 +91,12 @@ li.stepsection {
margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 0;
list-style-type: none;
}
+
+th, td { border: solid 1px; }
+
<!-- FIXME: perhaps into html.xsl? -->
div.links > div.inner > div.region > div.desc { font-style: italic; }
+th { text-align: left; }
</xsl:text>
</xsl:template>
diff --git a/xslt/dita/html/dita2xhtml.xsl b/xslt/dita/html/dita2xhtml.xsl
index 1e73bd1..0170604 100644
--- a/xslt/dita/html/dita2xhtml.xsl
+++ b/xslt/dita/html/dita2xhtml.xsl
@@ -59,6 +59,7 @@ http://www.w3.org/ns/ttml/feature/#timing
<xsl:include href="dita2html-block.xsl"/>
<xsl:include href="dita2html-inline.xsl"/>
<xsl:include href="dita2html-list.xsl"/>
+<xsl:include href="dita2html-table.xsl"/>
<xsl:include href="dita2html-topic.xsl"/>
</xsl:stylesheet>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]