diff options
-rw-r--r-- | ChangeLog | 23 | ||||
-rw-r--r-- | test/testdocs/Makefile | 2 | ||||
-rw-r--r-- | test/testdocs/db2html.xsl | 39 | ||||
-rw-r--r-- | xslt/docbook/html/Makefile.am | 1 | ||||
-rw-r--r-- | xslt/docbook/html/db2html-block.xsl | 5 | ||||
-rw-r--r-- | xslt/docbook/html/db2html-inline.xsl | 1 | ||||
-rw-r--r-- | xslt/docbook/html/db2html-list.xsl | 47 | ||||
-rw-r--r-- | xslt/docbook/html/db2html-media.xsl | 4 | ||||
-rw-r--r-- | xslt/docbook/html/db2html-table.xsl | 632 | ||||
-rw-r--r-- | xslt/docbook/html/db2html.xsl | 3 |
10 files changed, 732 insertions, 25 deletions
@@ -1,3 +1,26 @@ +2004-05-24 Shaun McCance <shaunm@gnome.org> + + * test/testdocs/Makefile: + * test/testdocs/db2html: + - Made a custom db2html to show the source + + * xslt/docbook/html/Makefile.am: + * xslt/docbook/html/db2html-table.xsl: + * xslt/docbook/html/db2html.xsl: + - Added db2html-table.xsl, mostly commented out + + * xslt/docbook/html/db2html-block.xsl: + - Added para + + * xslt/docbook/html/db2html-inline.xsl: + - Fixed trademark to process children + + * xslt/docbook/html/db2html-list.xsl: + - Re-added variablelist support + + * xslt/docbook/html/db2html-media.xsl: + - Commented out some problematic parts, needs to be fixed + 2004-05-22 Shaun McCance <shaunm@gnome.org> * test/testdocs/README: diff --git a/test/testdocs/Makefile b/test/testdocs/Makefile index 78a9ff1..33819c9 100644 --- a/test/testdocs/Makefile +++ b/test/testdocs/Makefile @@ -1,4 +1,4 @@ -db2html = ../../xslt/docbook/html/db2html.xsl +db2html = db2html.xsl tests = $(filter-out template.xml,$(wildcard *.xml)) htmls = $(patsubst %.xml,html/%,$(tests)) diff --git a/test/testdocs/db2html.xsl b/test/testdocs/db2html.xsl new file mode 100644 index 0000000..82d25e5 --- /dev/null +++ b/test/testdocs/db2html.xsl @@ -0,0 +1,39 @@ +<?xml version='1.0' encoding='utf-8'?><!-- -*- indent-tabs-mode: nil -*- --> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + +<xsl:include href="../../xslt/docbook/html/db2html.xsl"/> + +<xsl:template match="articleinfo/title | bookinfo/title"> + <xsl:param name="title_for" select=".."/> + <xsl:param name="depth_in_chunk"> + <xsl:call-template name="db.chunk.depth-in-chunk"/> + </xsl:param> + <xsl:call-template name="db2html.title.header"> + <xsl:with-param name="title_for" select="$title_for"/> + <xsl:with-param name="depth_in_chunk" select="$depth_in_chunk"/> + </xsl:call-template> + <pre style="margin: 0.8em; padding: 0.8em; background-color: #9EB6D1;"> + <xsl:apply-templates mode="source.mode" select="/"/> + </pre> +</xsl:template> + +<xsl:template mode="source.mode" match="*"> + <xsl:text><</xsl:text> + <xsl:value-of select="local-name(.)"/> + <xsl:for-each select="attribute::*"> + <xsl:text> </xsl:text> + <xsl:value-of select="name(.)"/> + <xsl:text>="</xsl:text> + <xsl:value-of select="."/> + <xsl:text>"</xsl:text> + </xsl:for-each> + <xsl:text>></xsl:text> + <xsl:apply-templates mode="source.mode" select="node()"/> + <xsl:text></</xsl:text> + <xsl:value-of select="local-name(.)"/> + <xsl:text>></xsl:text> +</xsl:template> + +</xsl:stylesheet> diff --git a/xslt/docbook/html/Makefile.am b/xslt/docbook/html/Makefile.am index 68b211d..3d68823 100644 --- a/xslt/docbook/html/Makefile.am +++ b/xslt/docbook/html/Makefile.am @@ -16,6 +16,7 @@ xsl_DATA = \ db2html-list.xsl \ db2html-qanda.xsl \ db2html-suppressed.xsl \ + db2html-table.xsl \ db2html-title.xsl \ db2html-xref.xsl \ db2html.xsl diff --git a/xslt/docbook/html/db2html-block.xsl b/xslt/docbook/html/db2html-block.xsl index 1f606ec..a4d334f 100644 --- a/xslt/docbook/html/db2html-block.xsl +++ b/xslt/docbook/html/db2html-block.xsl @@ -147,4 +147,9 @@ <xsl:call-template name="db2html.block"/> </xsl:template> +<!-- = para = --> +<xsl:template match="para"> + <xsl:call-template name="db2html.para"/> +</xsl:template> + </xsl:stylesheet> diff --git a/xslt/docbook/html/db2html-inline.xsl b/xslt/docbook/html/db2html-inline.xsl index e94df24..df6987d 100644 --- a/xslt/docbook/html/db2html-inline.xsl +++ b/xslt/docbook/html/db2html-inline.xsl @@ -760,6 +760,7 @@ </xsl:choose> </xsl:variable> <span class="trademark"> + <xsl:apply-templates/> <xsl:call-template name="db.dingbat"> <xsl:with-param name="dingbat" select="$class"/> </xsl:call-template> diff --git a/xslt/docbook/html/db2html-list.xsl b/xslt/docbook/html/db2html-list.xsl index 646e5ad..7c28bee 100644 --- a/xslt/docbook/html/db2html-list.xsl +++ b/xslt/docbook/html/db2html-list.xsl @@ -109,6 +109,7 @@ <xsl:otherwise>1</xsl:otherwise> </xsl:choose> </xsl:variable> + <!-- FIXME: auto-numeration for nested lists --> <div class="orderedlist"> <xsl:call-template name="db2html.anchor"/> <xsl:apply-templates select="*[name(.) != 'listitem']"/> @@ -331,40 +332,38 @@ <!-- ======================================================================= --> <!-- == variablelist ======================================================= --> -<!-- <xsl:template match="variablelist"> - <div class="variablelist"> - <xsl:call-template name="db2html.anchor"/> - <xsl:apply-templates select="*[name(.) != 'varlistentry']"/> - <dl> - <xsl:apply-templates select="varlistentry"/> - </dl> - </div> + <div class="variablelist"> + <xsl:call-template name="db2html.anchor"/> + <xsl:apply-templates select="*[name(.) != 'varlistentry']"/> + <dl> + <xsl:apply-templates select="varlistentry"/> + </dl> + </div> </xsl:template> <xsl:template match="varlistentry"> - <dt> - <xsl:call-template name="db2html.anchor"/> - <xsl:for-each select="term"> - <xsl:if test="position() != 1"> - <xsl:text>, </xsl:text> - </xsl:if> - <xsl:apply-templates select="."/> - </xsl:for-each> - </dt> - <xsl:apply-templates select="listitem"/> + <dt> + <xsl:call-template name="db2html.anchor"/> + <xsl:for-each select="term"> + <xsl:if test="position() != 1"> + <xsl:text>, </xsl:text> + </xsl:if> + <xsl:apply-templates select="."/> + </xsl:for-each> + </dt> + <xsl:apply-templates select="listitem"/> </xsl:template> <xsl:template match="varlistentry/listitem"> - <dd> - <xsl:call-template name="db2html.anchor"/> - <xsl:apply-templates/> - </dd> + <dd> + <xsl:call-template name="db2html.anchor"/> + <xsl:apply-templates/> + </dd> </xsl:template> <xsl:template match="term"> - <xsl:call-template name="inline"/> + <xsl:call-template name="db2html.inline"/> </xsl:template> ---> </xsl:stylesheet> diff --git a/xslt/docbook/html/db2html-media.xsl b/xslt/docbook/html/db2html-media.xsl index 7bcac3d..718226a 100644 --- a/xslt/docbook/html/db2html-media.xsl +++ b/xslt/docbook/html/db2html-media.xsl @@ -55,11 +55,13 @@ <xsl:value-of select="@align"/> </xsl:attribute> </xsl:if> +<!-- FIXME <xsl:if test="$textobject/phrase"> <xsl:attribute name="alt"> <xsl:value-of select="phrase[1]"/> </xsl:attribute> </xsl:if> +--> <!-- FIXME: longdesc --> </img> </xsl:template> @@ -69,9 +71,11 @@ <xsl:template name="db2html.mediaobject"> <xsl:choose> +<!-- FIXME <xsl:when test="$text_only"> <xsl:apply-templates select="textobject[1]"/> </xsl:when> +--> <xsl:when test="imageobject[imagedata/@format = 'PNG']"> <xsl:apply-templates select="imageobject[imagedata/@format = 'PNG'][1]"> diff --git a/xslt/docbook/html/db2html-table.xsl b/xslt/docbook/html/db2html-table.xsl new file mode 100644 index 0000000..4845ac6 --- /dev/null +++ b/xslt/docbook/html/db2html-table.xsl @@ -0,0 +1,632 @@ +<?xml version='1.0' encoding='utf-8'?><!-- -*- indent-tabs-mode: nil -*- --> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:doc="http://www.gnome.org/~shaunm/xsldoc" + exclude-result-prefixes="doc" + version="1.0"> + +<doc:title>Tables</doc:title> + + +<!-- == Matched Templates ================================================== --> + +<!-- = table = --> +<xsl:template match="table"> + <div class="table"> + <xsl:call-template name="db2html.anchor"/> + <xsl:apply-templates select="title"/> + <!-- FIXME: I have no idea what I'm supposed to do with textobject --> + <xsl:choose> + <xsl:when test="graphic | mediaobject"> + <xsl:apply-templates select="graphic | mediaobject"/> + </xsl:when> + <xsl:when test="tgroup"> + <xsl:apply-templates select="tgroup"/> + </xsl:when> + <!-- FIXME --> + </xsl:choose> + <xsl:apply-templates select="caption"/> + </div> +</xsl:template> + +<!-- +<xsl:template name="entry" match="entry | entrytbl"> + <xsl:param name="colspecs"/> + <xsl:param name="spanspecs"/> + <xsl:param name="colsep" select="false()"/> + <xsl:param name="rowsep" select="false()"/> + <xsl:param name="col" select="1"/> + <xsl:param name="spans"/> + <xsl:variable name="named.colnum"> + <xsl:call-template name="entry.colnum"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="entry" select="."/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="entry.colnum"> + <xsl:choose> + <xsl:when test="$named.colnum > 0"> + <xsl:value-of select="$named.colnum"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$col"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="entry.colspan"> + <xsl:choose> + <xsl:when test="@spanname or @namest"> + <xsl:call-template name="calculate.colspan"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="entry" select="."/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="following.spans"> + <xsl:call-template name="calculate.following.spans"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="colspan" select="$entry.colspan"/> + <xsl:with-param name="spans" select="$spans"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="element"> + <xsl:choose> + <xsl:when + test="name(../..) = 'thead' or name(../..) = 'tfoot'">th</xsl:when> + <xsl:otherwise>td</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="style"> + <xsl:if test="(following-sibling::*) and ( + (@colsep = '1') or + ($colspecs[@colname = current()/@colname]/@colsep = '1') or + ($colspecs[@colname = current()/@nameend]/@colsep = '1') or + ($spanspecs[@spanname = current()/@spanname]/@colsep = '1') or + ($colsep = '1' and ( + (@colsep != '0') or + ($colspecs[@colname = current()/@colname]/@colsep != '0') or + ($colspecs[@colname = current()/@nameend]/@colsep != '0') or + ($spanspecs[@spanname = current()/@spanname]/@colsep != '0') + )) )"> + <xsl:text>border-right: outset 1px; </xsl:text> + </xsl:if> + <xsl:if test="(../following-sibling::*) and ( + (@rowsep = '1') or + ($colspecs[@colname = current()/@colname]/@rowsep = '1') or + ($colspecs[@colname = current()/@namest]/@rowsep = '1') or + ($spanspecs[@spanname = current()/@spanname]/@rowsep = '1') or + ($rowsep = '1' and ( + (@rowsep != '0') or + ($colspecs[@colname = current()/@colname]/@rowsep != '0') or + ($colspecs[@colname = current()/@namest]/@rowsep != '0') or + ($spanspecs[@spanname = current()/@spanname]/@rowsep != '0') + )) )"> + <xsl:text>border-bottom: outset 1px; </xsl:text> + </xsl:if> + <xsl:choose> + <xsl:when test="@align"> + <xsl:text>text-align: </xsl:text> + <xsl:value-of select="@align"/> + <xsl:text>; </xsl:text> + </xsl:when> + <xsl:when + test="$colspecs[@colname = current()/@colname]/@align"> + <xsl:text>text-align: </xsl:text> + <xsl:value-of + select="$colspecs[@colname = current()/@colname]/@align"/> + <xsl:text>; </xsl:text> + </xsl:when> + <xsl:when + test="$colspecs[@colname = current()/@namest]/@align"> + <xsl:text>text-align: </xsl:text> + <xsl:value-of + select="$colspecs[@colname = current()/@namest]/@align"/> + <xsl:text>; </xsl:text> + </xsl:when> + <xsl:when + test="$spanspecs[@spanname = current()/@spanname]/@align"> + <xsl:text>text-align: </xsl:text> + <xsl:value-of + select="$spanspecs[@spanname = current()/@spanname]/@align"/> + <xsl:text>; </xsl:text> + </xsl:when> + <xsl:when test="../../../@align"> + <xsl:text>text-align: </xsl:text> + <xsl:value-of select="../../../@align"/> + <xsl:text>; </xsl:text> + </xsl:when> + </xsl:choose> + <xsl:choose> + <xsl:when test="@valign"> + <xsl:text>vertical-align: </xsl:text> + <xsl:value-of select="@valign"/> + <xsl:text>; </xsl:text> + </xsl:when> + <xsl:when + test="$colspecs[@colname = current()/@colname]/@valign"> + <xsl:text>vertical-align: </xsl:text> + <xsl:value-of + select="$colspecs[@colname = current()/@colname]/@valign"/> + <xsl:text>; </xsl:text> + </xsl:when> + <xsl:when + test="$colspecs[@colname = current()/@namest]/@valign"> + <xsl:text>vertical-align: </xsl:text> + <xsl:value-of + select="$colspecs[@colname = current()/@namest]/@valign"/> + <xsl:text>; </xsl:text> + </xsl:when> + <xsl:when + test="$spanspecs[@spanname = current()/@spanname]/@valign"> + <xsl:text>vertical-align: </xsl:text> + <xsl:value-of + select="$spanspecs[@spanname = current()/@spanname]/@valign"/> + <xsl:text>; </xsl:text> + </xsl:when> + <xsl:when test="../@valign"> + <xsl:text>vertical-align: </xsl:text> + <xsl:value-of select="../@valign"/> + <xsl:text>; </xsl:text> + </xsl:when> + <xsl:when test="../../@valign"> + <xsl:text>vertical-align: </xsl:text> + <xsl:value-of select="../../@valign"/> + <xsl:text>; </xsl:text> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="$spans != '' and not(starts-with($spans, '0:'))"> + <xsl:call-template name="entry"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="col" select="$col + 1"/> + <xsl:with-param name="spans" select="substring-after($spans, ':')"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$entry.colnum > $col"> + <td> + <xsl:if test="$style"> + <xsl:attribute name="style"> + <xsl:value-of select="$style"/> + </xsl:attribute> + </xsl:if> + <xsl:text> </xsl:text> + </td> + <xsl:call-template name="entry"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="col" select="$col + 1"/> + <xsl:with-param name="spans" select="substring-after($spans, ':')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="char"> + <xsl:choose> + <xsl:when test="@char"> + <xsl:value-of select="@char"/> + </xsl:when> + <xsl:when + test="$colspecs[@colname = current()/@colname]/@char"> + <xsl:value-of + select="$colspecs[@colname = current()/@colname]/@char"/> + </xsl:when> + <xsl:when + test="$colspecs[@colname = current()/@namest]/@char"> + <xsl:value-of + select="$colspecs[@colname = current()/@namest]/@char"/> + </xsl:when> + <xsl:when + test="$spanspecs[@spanname = current()/@spanname]/@char"> + <xsl:value-of + select="$spanspecs[@spanname = current()/@spanname]/@char"/> + </xsl:when> + <xsl:when test="../../../@char"> + <xsl:value-of select="../../@char"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="charoff"> + <xsl:choose> + <xsl:when test="@charoff"> + <xsl:value-of select="@charoff"/> + </xsl:when> + <xsl:when + test="$colspecs[@colname = current()/@colname]/@charoff"> + <xsl:value-of + select="$colspecs[@colname = current()/@colname]/@charoff"/> + </xsl:when> + <xsl:when + test="$colspecs[@colname = current()/@namest]/@charoff"> + <xsl:value-of + select="$colspecs[@colname = current()/@namest]/@charoff"/> + </xsl:when> + <xsl:when + test="$spanspecs[@spanname = current()/@spanname]/@charoff"> + <xsl:value-of + select="$spanspecs[@spanname = current()/@spanname]/@charoff"/> + </xsl:when> + <xsl:when test="../../../@charoff"> + <xsl:value-of select="../../@charoff"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:element name="{$element}"> + <xsl:if test="$style != ''"> + <xsl:attribute name="style"> + <xsl:value-of select="$style"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@morerows > 0"> + <xsl:attribute name="rowspan"> + <xsl:value-of select="@morerows + 1"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="$entry.colspan > 1"> + <xsl:attribute name="colspan"> + <xsl:value-of select="$entry.colspan"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="$char != ''"> + <xsl:attribute name="char"> + <xsl:value-of select="$char"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="$charoff != ''"> + <xsl:attribute name="charoff"> + <xsl:value-of select="$charoff"/> + </xsl:attribute> + </xsl:if> + <xsl:apply-templates/> + </xsl:element> + <xsl:apply-templates select="following-sibling::*[1]"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="colsep" select="$colsep"/> + <xsl:with-param name="rowsep" select="$rowsep"/> + <xsl:with-param name="col" select="$col + $entry.colspan"/> + <xsl:with-param name="spans" select="$following.spans"/> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template match="tbody | tfoot | thead"> + <xsl:param name="colspecs"/> + <xsl:param name="spanspecs"/> + <xsl:param name="colsep" select="false()"/> + <xsl:param name="rowsep" select="false()"/> + <xsl:element name="{name(.)}"> + <xsl:if test="@valign"> + <xsl:attribute name="valign"> + <xsl:value-of select="@valign"/> + </xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="colspec"> + <xsl:apply-templates select="row[1]"> + <xsl:with-param name="colspecs" select="colspec"/> + <xsl:with-param name="spanspecs" select="spanspec"/> + <xsl:with-param name="colsep" select="$colsep"/> + <xsl:with-param name="rowsep" select="$rowsep"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="row[1]"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="colsep" select="$colsep"/> + <xsl:with-param name="rowsep" select="$rowsep"/> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:element> +</xsl:template> + +<xsl:template match="tgroup"> + <xsl:variable name="style"> + <xsl:if test="(../@frame) and (../@frame != 'all')"> + <xsl:text>border: none; </xsl:text> + </xsl:if> + <xsl:if test="../@frame = 'bottom' or ../@frame = 'topbot'"> + <xsl:text>border-bottom: outset 1px; </xsl:text> + </xsl:if> + <xsl:if test="../@frame = 'top' or ../@frame = 'topbot'"> + <xsl:text>border-top: outset 1px; </xsl:text> + </xsl:if> + <xsl:if test="../@frame = 'sides'"> + <xsl:text>border-left: outset 1px; border-right: outset 1px; </xsl:text> + </xsl:if> + </xsl:variable> + <table> + <xsl:if test="../title"> + <xsl:attribute name="summary"> + <xsl:value-of select="../title"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="../@pgwide = '1'"> + <xsl:attribute name="width">100%</xsl:attribute> + </xsl:if> + <xsl:if test="string($style) != ''"> + <xsl:attribute name="style"> + <xsl:value-of select="$style"/> + </xsl:attribute> + </xsl:if> + <xsl:apply-templates select="thead"> + <xsl:with-param name="colspecs" select="colspec"/> + <xsl:with-param name="spanspecs" select="spanspec"/> + <xsl:with-param name="colsep" select="@colsep = '1'"/> + <xsl:with-param name="rowsep" select="@rowsep = '1'"/> + </xsl:apply-templates> + <xsl:apply-templates select="tbody"> + <xsl:with-param name="colspecs" select="colspec"/> + <xsl:with-param name="spanspecs" select="spanspec"/> + <xsl:with-param name="colsep" select="@colsep = '1'"/> + <xsl:with-param name="rowsep" select="@rowsep = '1'"/> + </xsl:apply-templates> + <xsl:apply-templates select="tfoot"> + <xsl:with-param name="colspecs" select="colspec"/> + <xsl:with-param name="spanspecs" select="spanspec"/> + <xsl:with-param name="colsep" select="@colsep = '1'"/> + <xsl:with-param name="rowsep" select="@rowsep = '1'"/> + </xsl:apply-templates> + </table> +</xsl:template> + +<xsl:template match="row"> + <xsl:param name="colspecs"/> + <xsl:param name="spanspecs"/> + <xsl:param name="colsep" select="false()"/> + <xsl:param name="rowsep" select="false()"/> + <xsl:param name="spans"/> + <tr> + <xsl:if test="name(..) = 'tbody'"> + <xsl:attribute name="class"> + <xsl:choose> + <xsl:when + test="count(preceding-sibling::row) mod 2">odd</xsl:when> + <xsl:otherwise>even</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:if> + <xsl:apply-templates select="*[1]"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="colsep" select="$colsep"/> + <xsl:with-param name="rowsep" select=" + (@rowsep = '1') or ((@rowsep != '0') and $rowsep)"/> + <xsl:with-param name="spans" select="$spans"/> + </xsl:apply-templates> + </tr> + <xsl:apply-templates select="following-sibling::row[1]"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="colsep" select="$colsep"/> + <xsl:with-param name="rowsep" select="$rowsep"/> + <xsl:with-param name="spans"> + <xsl:apply-templates select="*[1]" mode="span"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="spans" select="$spans"/> + </xsl:apply-templates> + </xsl:with-param> + </xsl:apply-templates> +</xsl:template> + + +<xsl:template mode="span" name="entry.span" match="entry | entrytbl"> + <xsl:param name="colspecs"/> + <xsl:param name="spanspecs"/> + <xsl:param name="col" select="1"/> + <xsl:param name="spans"/> + <xsl:variable name="entry.colnum"> + <xsl:call-template name="entry.colnum"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="entry" select="."/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="entry.colspan"> + <xsl:choose> + <xsl:when test="@spanname or @namest"> + <xsl:call-template name="calculate.colspan"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="entry" select="."/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="following.spans"> + <xsl:call-template name="calculate.following.spans"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="colspan" select="$entry.colspan"/> + <xsl:with-param name="spans" select="$spans"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$spans != '' and not(starts-with($spans, '0:'))"> + <xsl:value-of select="substring-before($spans, ':') - 1"/> + <xsl:text>:</xsl:text> + <xsl:call-template name="entry.span"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="col" select="$col + 1"/> + <xsl:with-param name="spans" select="substring-after($spans, ':')"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$entry.colnum > $col"> + <xsl:text>0:</xsl:text> + <xsl:call-template name="entry.span"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="col" select="$col + $entry.colspan"/> + <xsl:with-param name="spans" select="$following-spans"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="copy-string"> + <xsl:with-param name="count" select="$entry.colspan"/> + <xsl:with-param name="string"> + <xsl:choose> + <xsl:when test="@morerows"> + <xsl:value-of select="@morerows"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + <xsl:text>:</xsl:text> + </xsl:with-param> + </xsl:call-template> + <xsl:if test="following-sibling::*"> + <xsl:apply-templates select="following-sibling::*[1]" mode="span"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="col" select="$col + $entry.colspan"/> + <xsl:with-param name="spans" select="$following.spans"/> + </xsl:apply-templates> + </xsl:if> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template name="entry.colnum"> + <xsl:param name="colspecs"/> + <xsl:param name="spanspecs"/> + <xsl:param name="entry" select="."/> + <xsl:choose> + <xsl:when test="$entry/@spanname"> + <xsl:variable name="spanspec" + select="$spanspecs[@spanname = $entry/@spanname]"/> + <xsl:variable name="colspec" + select="$colspecs[@colname = $spanspec/@namest]"/> + <xsl:call-template name="colspec.colnum"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="colspec" select="$colspec"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$entry/@colname"> + <xsl:variable name="colspec" + select="$colspecs[@colname = $entry/@colname]"/> + <xsl:call-template name="colspec.colnum"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="colspec" select="$colspec"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$entry/@namest"> + <xsl:variable name="colspec" + select="$colspecs[@colname = $entry/namest]"/> + <xsl:call-template name="colspec.colnum"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="colspec" select="$colspec"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template name="colspec.colnum"> + <xsl:param name="colspecs"/> + <xsl:param name="spanspecs"/> + <xsl:param name="colspec" select="."/> + <xsl:choose> + <xsl:when test="$colspec/@colnum"> + <xsl:value-of select="$colspec/@colnum"/> + </xsl:when> + <xsl:when test="$colspec/preceding-sibling::colspec"> + <xsl:variable name="prec.colspec.colnum"> + <xsl:call-template name="colspec.colnum"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="colspec" + select="$colspec/preceding-sibling::colspec[1]"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$prec.colspec.colnum + 1"/> + </xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template name="calculate.colspan"> + <xsl:param name="colspecs"/> + <xsl:param name="spanspecs"/> + <xsl:param name="entry" select="."/> + <xsl:variable name="namest"> + <xsl:choose> + <xsl:when test="$entry/@spanname"> + <xsl:value-of + select="$spanspecs[@spanname = $entry/@spanname]/@namest"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$entry/@namest"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="nameend"> + <xsl:choose> + <xsl:when test="$entry/@spanname"> + <xsl:value-of + select="$spanspecs[@spanname = $entry/@spanname]/@nameend"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$entry/@nameend"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="colnumst"> + <xsl:call-template name="colspec.colnum"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="colspec" select="$colspecs[@colname = $namest]"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="colnumend"> + <xsl:call-template name="colspec.colnum"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="colspec" select="$colspecs[@colname = $nameend]"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$namest = '' or $nameend = ''">1</xsl:when> + <xsl:when test="$colnumend > $colnumst"> + <xsl:value-of select="$colnumend - $colnumst + 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$colnumst - $colnumend + 1"/> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template name="calculate.following.spans"> + <xsl:param name="colspecs"/> + <xsl:param name="spanspecs"/> + <xsl:param name="colspan" select="1"/> + <xsl:param name="spans" select="''"/> + <xsl:choose> + <xsl:when test="$colspan > 0"> + <xsl:call-template name="calculate.following.spans"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="colspan" select="$colspan - 1"/> + <xsl:with-param name="spans" select="substring-after($spans, ':')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$spans"/> + </xsl:otherwise> + </xsl:choose> +</xsl:template> +--> + +</xsl:stylesheet> diff --git a/xslt/docbook/html/db2html.xsl b/xslt/docbook/html/db2html.xsl index ac5971f..913b7d5 100644 --- a/xslt/docbook/html/db2html.xsl +++ b/xslt/docbook/html/db2html.xsl @@ -60,6 +60,9 @@ <xsl:include href="db2html-suppressed.xsl" doc:summary="true" doc:include="true"/> +<xsl:include href="db2html-table.xsl" + doc:summary="true" + doc:include="true"/> <xsl:include href="db2html-title.xsl" doc:summary="true" doc:include="true"/> |