diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | test/testdocs/table.x001.xml | 23 | ||||
-rw-r--r-- | xslt/docbook/html/db2html-table.xsl | 557 |
3 files changed, 334 insertions, 252 deletions
@@ -1,3 +1,9 @@ +2004-07-14 Shaun McCance <shaunm@gnome.org> + + * test/testdocs/table.x001.xml: + * xslt/docbook/html/db2html-table.xsl: + - Completed table support, sans a few attributes + 2004-07-12 Shaun McCance <shaunm@gnome.org> * test/testdocs/README: diff --git a/test/testdocs/table.x001.xml b/test/testdocs/table.x001.xml index e527d06..3245e70 100644 --- a/test/testdocs/table.x001.xml +++ b/test/testdocs/table.x001.xml @@ -12,7 +12,7 @@ </articleinfo> <informaltable> - <tgroup> + <tgroup cols="5"> <colspec colname="first"/> <colspec colname="second"/> <colspec colname="fourth" colnum="4"/> @@ -32,18 +32,35 @@ </thead> <tbody> <row rowsep="1"> - <entry spanname="first-fourth">rowspan=4</entry> + <entry spanname="first-fourth">colspan=4 colspan=4 colspan=4</entry> <entry>fe</entry> </row> <row> <entry>fi</entry> <entry>fo</entry> - <entry>fum</entry> + <entry morerows="2"><screen>fum +fum +fum +fum +fum +fum +fum +fum</screen></entry> + <entry>fe fi</entry> + <entry>fo fum</entry> </row> <row> + <entry morerows="1"><screen>rowspan=2 +rowspan=2 +rowspan=2 +rowspan=2</screen></entry> <entry colname="fourth">fourth</entry> <entry>fifth</entry> </row> + <row> + <entry>second</entry> + <entry colname="fifth">fifth</entry> + </row> </tbody> </tgroup> </informaltable> diff --git a/xslt/docbook/html/db2html-table.xsl b/xslt/docbook/html/db2html-table.xsl index c26e0f6..64c2d48 100644 --- a/xslt/docbook/html/db2html-table.xsl +++ b/xslt/docbook/html/db2html-table.xsl @@ -11,39 +11,39 @@ <!-- == Matched Templates ================================================== --> <!-- = entry | entrytbl = --> -<xsl:template name="entry" match="entry | entrytbl"> +<xsl:template 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="entry.colnum"> + <xsl:param name="colnum" select="1"/> + <xsl:param name="spanstr"/> + <xsl:param name="entry.colnum"> <xsl:call-template name="db2html.entry.colnum"> - <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="colspecs" select="$colspecs"/> <xsl:with-param name="spanspecs" select="$spanspecs"/> - <xsl:with-param name="entry" select="."/> - <xsl:with-param name="col" select="$col"/> + <xsl:with-param name="entry" select="."/> + <xsl:with-param name="colnum" select="$colnum"/> </xsl:call-template> - </xsl:variable> - <xsl:variable name="entry.colspan"> + </xsl:param> + <xsl:param name="entry.colspan"> <xsl:choose> <xsl:when test="@spanname or @namest"> <xsl:call-template name="db2html.entry.colspan"> - <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="colspecs" select="$colspecs"/> <xsl:with-param name="spanspecs" select="$spanspecs"/> - <xsl:with-param name="entry" select="."/> + <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="db2html.pop.spans"> - <xsl:with-param name="colspecs" select="$colspecs"/> + </xsl:param> + <xsl:variable name="following.spanstr"> + <xsl:call-template name="db2html.spanstr.pop"> + <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:with-param name="colspan" select="$entry.colspan"/> + <xsl:with-param name="spanstr" select="$spanstr"/> </xsl:call-template> </xsl:variable> <xsl:variable name="element"> @@ -55,102 +55,25 @@ </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:call-template name="db2html.entry.style"> + <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:call-template> </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:when test="$spanstr != '' and not(starts-with($spanstr, '0:'))"> + <xsl:apply-templates select="."> + <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:with-param name="colnum" select="$colnum + 1"/> + <xsl:with-param name="spanstr" select="substring-after($spanstr, ':')"/> + <xsl:with-param name="entry.colnum" select="$entry.colnum"/> + <xsl:with-param name="entry.colspan" select="$entry.colspan"/> + </xsl:apply-templates> </xsl:when> - <xsl:when test="$entry.colnum > $col"> + <xsl:when test="$entry.colnum > $colnum"> <td> <xsl:if test="$style"> <xsl:attribute name="style"> @@ -159,12 +82,14 @@ </xsl:if> <xsl:text> </xsl:text> </td> - <xsl:call-template name="entry"> - <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:apply-templates select="."> + <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:with-param name="colnum" select="$colnum + 1"/> + <xsl:with-param name="spanstr" select="substring-after($spanstr, ':')"/> + <xsl:with-param name="entry.colnum" select="$entry.colnum"/> + <xsl:with-param name="entry.colspan" select="$entry.colspan"/> + </xsl:apply-templates> </xsl:when> <xsl:otherwise> <xsl:variable name="char"> @@ -173,13 +98,16 @@ <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: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: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:value-of + select="$spanspecs[@spanname = current()/@spanname]/@char"/> </xsl:when> <xsl:when test="../../../@char"> <xsl:value-of select="../../@char"/> @@ -192,13 +120,16 @@ <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: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: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:value-of + select="$spanspecs[@spanname = current()/@spanname]/@charoff"/> </xsl:when> <xsl:when test="../../../@charoff"> <xsl:value-of select="../../@charoff"/> @@ -231,27 +162,64 @@ <xsl:value-of select="$charoff"/> </xsl:attribute> </xsl:if> - <!-- FIXME: just for testing the tables --> - <div style="border: solid 1px red; padding-left: 3px; padding-right: 3px;"> - <xsl:value-of select="$spans"/> - <br/> - <xsl:apply-templates/> - </div> + <xsl:apply-templates/> </xsl:element> <xsl:apply-templates select="following-sibling::*[1]"> - <xsl:with-param name="colspecs" select="$colspecs"/> + <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:with-param name="colsep" select="$colsep"/> + <xsl:with-param name="rowsep" select="$rowsep"/> + <xsl:with-param name="colnum" select="$colnum + $entry.colspan"/> + <xsl:with-param name="spanstr" select="$following.spanstr"/> </xsl:apply-templates> </xsl:otherwise> </xsl:choose> </xsl:template> +<!-- = row = --> +<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="spanstr"/> + <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="spanstr" select="$spanstr"/> + </xsl:apply-templates> + </tr> + <xsl:if test="following-sibling::row"> + <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="spanstr"> + <xsl:call-template name="db2html.spanstr"> + <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="spanspecs" select="$spanspecs"/> + <xsl:with-param name="spanstr" select="$spanstr"/> + </xsl:call-template> + </xsl:with-param> + </xsl:apply-templates> + </xsl:if> +</xsl:template> + <!-- = table = --> -<xsl:template match="table"> +<xsl:template match="table | informaltable"> <div class="table"> <xsl:call-template name="db2html.anchor"/> <xsl:apply-templates select="title"/> @@ -359,46 +327,6 @@ </xsl:element> </xsl:template> -<!-- = row = --> -<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:call-template name="db2html.calculate.spans"> - <xsl:with-param name="colspecs" select="$colspecs"/> - <xsl:with-param name="spanspecs" select="$spanspecs"/> - <xsl:with-param name="spans" select="$spans"/> - </xsl:call-template> - </xsl:with-param> - </xsl:apply-templates> -</xsl:template> - <!-- == Here Be Dragons ==================================================== --> @@ -440,7 +368,7 @@ <xsl:param name="colspecs"/> <xsl:param name="spanspecs"/> <xsl:param name="entry" select="."/> - <xsl:param name="col" select="0"/> + <xsl:param name="colnum" select="0"/> <xsl:choose> <xsl:when test="$entry/@spanname"> <xsl:variable name="spanspec" @@ -464,7 +392,7 @@ </xsl:when> <xsl:when test="$entry/@namest"> <xsl:variable name="colspec" - select="$colspecs[@colname = $entry/namest]"/> + select="$colspecs[@colname = $entry/@namest]"/> <xsl:call-template name="db2html.colspec.colnum"> <xsl:with-param name="colspecs" select="$colspecs"/> <xsl:with-param name="spanspecs" select="$spanspecs"/> @@ -472,7 +400,7 @@ </xsl:call-template> </xsl:when> <xsl:otherwise> - <xsl:value-of select="$col"/> + <xsl:value-of select="$colnum"/> </xsl:otherwise> </xsl:choose> </xsl:template> @@ -515,8 +443,8 @@ </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:call-template name="db2html.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]"/> @@ -529,7 +457,7 @@ </xsl:template> -<!-- == db2html.colspec.colnum ============================================= --> +<!-- == db2html.colspec.colspan ============================================ --> <template xmlns="http://www.gnome.org/~shaunm/xsldoc"> <name>db2html.entry.colspan</name> @@ -585,16 +513,16 @@ </xsl:variable> <xsl:variable name="colnumst"> <xsl:call-template name="db2html.colspec.colnum"> - <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="colspecs" select="$colspecs"/> <xsl:with-param name="spanspecs" select="$spanspecs"/> - <xsl:with-param name="colspec" select="$colspecs[@colname = $namest]"/> + <xsl:with-param name="colspec" select="$colspecs[@colname = $namest]"/> </xsl:call-template> </xsl:variable> <xsl:variable name="colnumend"> <xsl:call-template name="db2html.colspec.colnum"> - <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="colspecs" select="$colspecs"/> <xsl:with-param name="spanspecs" select="$spanspecs"/> - <xsl:with-param name="colspec" select="$colspecs[@colname = $nameend]"/> + <xsl:with-param name="colspec" select="$colspecs[@colname = $nameend]"/> </xsl:call-template> </xsl:variable> <xsl:choose> @@ -609,12 +537,13 @@ </xsl:template> -<!-- == db2html.pop.spans ================================================== --> +<!-- == db2html.entry.style ================================================ --> <template xmlns="http://www.gnome.org/~shaunm/xsldoc"> - <name>db2html.pop.spans</name> + <name>db2html.entry.style</name> <description> - Calculate the remaining spans after an <xmltag>entry</xmltag> element + Generate the <xmltag role="attribute">style</xmltag> attribute for an + <xmltag>entry</xmltag> element </description> <parameter> <name>colspecs</name> @@ -628,95 +557,169 @@ The <xmltag>spanspec</xmltag> elements in scope </description> </parameter> - <parameter> - <name>colspan</name> - <description> - The number of columns to pop - </description> - </parameter> - <parameter> - <name>spans</name> - <description> - The string representation of the column spans - </description> - </parameter> </template> -<xsl:template name="db2html.pop.spans"> +<xsl:template name="db2html.entry.style"> <xsl:param name="colspecs"/> <xsl:param name="spanspecs"/> - <xsl:param name="colspan" select="1"/> - <xsl:param name="spans" select="''"/> + <xsl:param name="colsep" select="false()"/> + <xsl:param name="rowsep" select="false()"/> + <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="$colspan > 0"> - <xsl:call-template name="db2html.pop.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 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:otherwise> - <xsl:value-of select="$spans"/> - </xsl:otherwise> </xsl:choose> </xsl:template> -<!-- == db2html.calculate.spans ============================================ --> +<!-- == db2html.spanstr ==================================================== --> -<xsl:template name="db2html.calculate.spans"> +<xsl:template name="db2html.spanstr"> <xsl:param name="colspecs"/> <xsl:param name="spanspecs"/> - <xsl:param name="entry" select="*[1]"/> - <xsl:param name="col" select="1"/> - <xsl:param name="spans"/> - <xsl:variable name="entry.colnum"> + <xsl:param name="spanstr"/> + <xsl:param name="row" select="."/> + <xsl:param name="entry" select="$row/*[1]"/> + <xsl:param name="colnum" select="1"/> + <xsl:param name="entry.colnum"> <xsl:call-template name="db2html.entry.colnum"> - <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="colspecs" select="$colspecs"/> <xsl:with-param name="spanspecs" select="$spanspecs"/> - <xsl:with-param name="entry" select="$entry"/> + <xsl:with-param name="entry" select="$entry"/> </xsl:call-template> - </xsl:variable> - <xsl:variable name="entry.colspan"> + </xsl:param> + <xsl:param name="entry.colspan"> <xsl:choose> - <xsl:when test="@spanname or @namest"> + <xsl:when test="$entry/@spanname or $entry/@namest"> <xsl:call-template name="db2html.entry.colspan"> - <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:with-param name="colspecs" select="$colspecs"/> <xsl:with-param name="spanspecs" select="$spanspecs"/> - <xsl:with-param name="entry" select="$entry"/> + <xsl:with-param name="entry" select="$entry"/> </xsl:call-template> </xsl:when> <xsl:otherwise>1</xsl:otherwise> </xsl:choose> - </xsl:variable> - <xsl:variable name="following.spans"> - <xsl:call-template name="db2html.pop.spans"> - <xsl:with-param name="colspecs" select="$colspecs"/> + </xsl:param> + <xsl:variable name="following.spanstr"> + <xsl:call-template name="db2html.spanstr.pop"> + <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:with-param name="colspan" select="$entry.colspan"/> + <xsl:with-param name="spanstr" select="$spanstr"/> </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:when test="$spanstr != '' and not(starts-with($spanstr, '0:'))"> + <xsl:value-of select="substring-before($spanstr, ':') - 1"/> <xsl:text>:</xsl:text> - <xsl:call-template name="db2html.calculate.spans"> - <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:call-template name="db2html.spanstr"> + <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:with-param name="spanstr" select="substring-after($spanstr, ':')"/> + <xsl:with-param name="row" select="$row"/> + <xsl:with-param name="entry" select="$entry"/> + <xsl:with-param name="colnum" select="$colnum + 1"/> + <xsl:with-param name="entry.colnum" select="$entry.colnum"/> + <xsl:with-param name="entry.colspan" select="$entry.colspan"/> </xsl:call-template> </xsl:when> - <xsl:when test="$entry.colnum > $col"> + <xsl:when test="$entry.colnum > $colnum"> <xsl:text>0:</xsl:text> - <xsl:call-template name="db2html.calculate.spans"> - <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:call-template name="db2html.spanstr"> + <xsl:with-param name="colspecs" select="$colspecs"/> <xsl:with-param name="spanspecs" select="$spanspecs"/> - <xsl:with-param name="entry" select="$entry"/> - <xsl:with-param name="col" select="$col + $entry.colspan"/> - <xsl:with-param name="spans" select="$following.spans"/> + <xsl:with-param name="spanstr" select="$following.spanstr"/> + <xsl:with-param name="row" select="$row"/> + <xsl:with-param name="entry" select="$entry"/> + <xsl:with-param name="colnum" select="$colnum + $entry.colspan"/> + <xsl:with-param name="entry.colnum" select="$entry.colnum"/> + <xsl:with-param name="entry.colspan" select="$entry.colspan"/> </xsl:call-template> </xsl:when> <xsl:otherwise> @@ -724,27 +727,83 @@ <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 test="$entry/@morerows"> + <xsl:value-of select="$entry/@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="db2html.calcspan.mode"> - <xsl:with-param name="colspecs" select="$colspecs"/> + <xsl:if test="$entry/following-sibling::*"> + <xsl:call-template name="db2html.spanstr"> + <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:with-param name="spanstr" select="$following.spanstr"/> + <xsl:with-param name="row" select="$row"/> + <xsl:with-param name="entry" select="$entry/following-sibling::*[1]"/> + <xsl:with-param name="colnum" select="$colnum + $entry.colspan"/> + </xsl:call-template> </xsl:if> </xsl:otherwise> </xsl:choose> </xsl:template> +<!-- == db2html.spanstr.pop ================================================ --> + +<template xmlns="http://www.gnome.org/~shaunm/xsldoc"> + <name>db2html.spanstr.pop</name> + <description> + Calculate the remaining spans after an <xmltag>entry</xmltag> element + </description> + <parameter> + <name>colspecs</name> + <description> + The <xmltag>colspec</xmltag> elements in scope + </description> + </parameter> + <parameter> + <name>spanspecs</name> + <description> + The <xmltag>spanspec</xmltag> elements in scope + </description> + </parameter> + <parameter> + <name>colspan</name> + <description> + The number of columns to pop + </description> + </parameter> + <parameter> + <name>spans</name> + <description> + The string representation of the column spans + </description> + </parameter> +</template> + +<xsl:template name="db2html.spanstr.pop"> + <xsl:param name="colspecs"/> + <xsl:param name="spanspecs"/> + <xsl:param name="colspan" select="1"/> + <xsl:param name="spanstr" select="''"/> + <xsl:choose> + <xsl:when test="$colspan > 0"> + <xsl:call-template name="db2html.spanstr.pop"> + <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="spanstr" select="substring-after($spanstr, ':')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$spanstr"/> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + + <xsl:template name="copy-string"> <xsl:param name="count" select="1"/> <xsl:param name="string"/> |