]> granicus.if.org Git - docbook-dsssl/commitdiff
Fix calculation of rowsep and colsep; added experimental support for table.borders...
authorNorman Walsh <ndw@nwalsh.com>
Mon, 15 Oct 2001 12:42:44 +0000 (12:42 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Mon, 15 Oct 2001 12:42:44 +0000 (12:42 +0000)
xsl/common/table.xsl
xsl/fo/param.ent
xsl/fo/param.xweb
xsl/fo/table.xsl
xsl/html/param.ent
xsl/html/param.xweb
xsl/html/table.xsl
xsl/params/table.borders.with.css.xml [new file with mode: 0644]
xsl/params/table.entry.padding.xml [new file with mode: 0644]

index 0644dec2acb966df00ecd2394a9c19a21296526c..895e92da3e35735681172f22e1a7c9af3b30fdf1 100644 (file)
 
 <xsl:template name="finaltd">
   <xsl:param name="spans"/>
+  <xsl:param name="col" select="0"/>
 
   <xsl:if test="$spans != ''">
     <xsl:choose>
       <xsl:when test="starts-with($spans,'0:')">
-        <xsl:call-template name="empty.table.cell"/>
+        <xsl:call-template name="empty.table.cell">
+          <xsl:with-param name="colnum" select="$col"/>
+        </xsl:call-template>
       </xsl:when>
       <xsl:otherwise></xsl:otherwise>
     </xsl:choose>
 
     <xsl:call-template name="finaltd">
       <xsl:with-param name="spans" select="substring-after($spans,':')"/>
+      <xsl:with-param name="col" select="$col+1"/>
     </xsl:call-template>
   </xsl:if>
 </xsl:template>
   <xsl:param name="entry" select="."/>
 
   <xsl:choose>
+    <xsl:when test="$entry/@spanname">
+      <xsl:variable name="spanname" select="$entry/@spanname"/>
+      <xsl:variable name="spanspec"
+                    select="$entry/ancestor::tgroup/spanspec[@spanname=$spanname]"/>
+      <xsl:variable name="colspec"
+                    select="$entry/ancestor::tgroup/colspec[@colname=$spanspec/@namest]"/>
+      <xsl:call-template name="colspec.colnum">
+        <xsl:with-param name="colspec" select="$colspec"/>
+      </xsl:call-template>
+    </xsl:when>
     <xsl:when test="$entry/@colname">
       <xsl:variable name="colname" select="$entry/@colname"/>
       <xsl:variable name="colspec"
@@ -137,8 +151,31 @@ or 0 (the empty string)</para>
 
 <xsl:template name="calculate.colspan">
   <xsl:param name="entry" select="."/>
-  <xsl:variable name="namest" select="$entry/@namest"/>
-  <xsl:variable name="nameend" select="$entry/@nameend"/>
+  <xsl:variable name="spanname" select="$entry/@spanname"/>
+  <xsl:variable name="spanspec"
+                select="$entry/ancestor::tgroup/spanspec[@spanname=$spanname]"/>
+
+  <xsl:variable name="namest">
+    <xsl:choose>
+      <xsl:when test="@spanname">
+        <xsl:value-of select="$spanspec/@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="@spanname">
+        <xsl:value-of select="$spanspec/@nameend"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$entry/@nameend"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
 
   <xsl:variable name="scol">
     <xsl:call-template name="colspec.colnum">
@@ -155,4 +192,216 @@ or 0 (the empty string)</para>
   <xsl:value-of select="$ecol - $scol + 1"/>
 </xsl:template>
 
+<xsl:template name="X.calculate.rowsep">
+  <xsl:param name="entry" select="."/>
+  <xsl:param name="colnum" select="0"/>
+
+  <xsl:choose>
+    <xsl:when test="$entry/ancestor::table/@frame = 'all'
+                    or $entry/ancestor::informaltable/@frame = 'all'">1</xsl:when>
+    <xsl:when test="$entry/@rowsep">
+      <xsl:value-of select="$entry/@rowsep"/>
+    </xsl:when>
+    <xsl:when test="$entry/ancestor::row[1]/@rowsep">
+      <xsl:value-of select="$entry/ancestor::row[1]/@rowsep"/>
+    </xsl:when>
+    <xsl:otherwise>0</xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="calculate.rowsep">
+  <xsl:param name="entry" select="."/>
+  <xsl:param name="colnum" select="0"/>
+
+<!--
+  <xsl:text>[</xsl:text>
+  <xsl:value-of select="$colnum"/>
+  <xsl:text>]</xsl:text>
+-->
+
+  <xsl:choose>
+    <xsl:when test="$entry/ancestor::table/@frame = 'all'
+                    or $entry/ancestor::informaltable/@frame = 'all'">
+      <xsl:value-of select="1"/>
+    </xsl:when>
+    <xsl:when test="$entry/@rowsep">
+      <xsl:value-of select="$entry/@rowsep"/>
+    </xsl:when>
+    <xsl:when test="$entry/ancestor::row[1]/@rowsep">
+      <xsl:value-of select="$entry/ancestor::row[1]/@rowsep"/>
+    </xsl:when>
+    <xsl:when test="$entry/@spanname">
+      <xsl:variable name="spanname" select="$entry/@spanname"/>
+      <xsl:variable name="spanspec"
+                    select="$entry/ancestor::tgroup/spanspec[@spanname=$spanname]"/>
+      <xsl:variable name="span.colspec"
+                    select="$entry/ancestor::tgroup/colspec[@colname=$spanspec/@namest]"/>
+      <xsl:choose>
+        <xsl:when test="$spanspec/@rowsep">
+          <xsl:value-of select="$spanspec/@rowsep"/>
+        </xsl:when>
+        <xsl:when test="$span.colspec/@rowsep">
+          <xsl:value-of select="$span.colspec/@rowsep"/>
+        </xsl:when>
+        <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:when test="$entry/@namest">
+      <xsl:variable name="namest" select="$entry/@namest"/>
+      <xsl:variable name="colspec"
+                    select="$entry/ancestor::tgroup/colspec[@colname=$namest]"/>
+      <xsl:choose>
+        <xsl:when test="$colspec/@rowsep">
+          <xsl:value-of select="$colspec/@rowsep"/>
+        </xsl:when>
+        <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:when test="$colnum &gt; 0">
+      <xsl:variable name="calc.rowsep">
+        <xsl:call-template name="colnum.colspec">
+          <xsl:with-param name="colnum" select="$colnum"/>
+          <xsl:with-param name="attribute" select="'rowsep'"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:choose>
+        <xsl:when test="$calc.rowsep != ''">
+          <xsl:value-of select="$calc.rowsep"/>
+        </xsl:when>
+        <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>0</xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="calculate.colsep">
+  <xsl:param name="entry" select="."/>
+  <xsl:param name="colnum" select="0"/>
+
+<!--
+  <xsl:text>[</xsl:text>
+  <xsl:value-of select="$colnum"/>
+  <xsl:text>]</xsl:text>
+-->
+
+  <xsl:choose>
+    <xsl:when test="$entry/ancestor::table/@frame = 'all'
+                    or $entry/ancestor::informaltable/@frame = 'all'">
+      <xsl:value-of select="1"/>
+    </xsl:when>
+    <xsl:when test="$entry/@colsep">
+      <xsl:value-of select="$entry/@colsep"/>
+    </xsl:when>
+    <xsl:when test="$entry/ancestor::row[1]/@colsep">
+      <xsl:value-of select="$entry/ancestor::row[1]/@colsep"/>
+    </xsl:when>
+    <xsl:when test="$entry/@spanname">
+      <xsl:variable name="spanname" select="$entry/@spanname"/>
+      <xsl:variable name="spanspec"
+                    select="$entry/ancestor::tgroup/spanspec[@spanname=$spanname]"/>
+      <xsl:variable name="span.colspec"
+                    select="$entry/ancestor::tgroup/colspec[@colname=$spanspec/@namest]"/>
+      <xsl:choose>
+        <xsl:when test="$spanspec/@colsep">
+          <xsl:value-of select="$spanspec/@colsep"/>
+        </xsl:when>
+        <xsl:when test="$span.colspec/@colsep">
+          <xsl:value-of select="$span.colspec/@colsep"/>
+        </xsl:when>
+        <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:when test="$entry/@namest">
+      <xsl:variable name="namest" select="$entry/@namest"/>
+      <xsl:variable name="colspec"
+                    select="$entry/ancestor::tgroup/colspec[@colname=$namest]"/>
+      <xsl:choose>
+        <xsl:when test="$colspec/@colsep">
+          <xsl:value-of select="$colspec/@colsep"/>
+        </xsl:when>
+        <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:when test="$colnum &gt; 0">
+      <xsl:variable name="calc.colsep">
+        <xsl:call-template name="colnum.colspec">
+          <xsl:with-param name="colnum" select="$colnum"/>
+          <xsl:with-param name="attribute" select="'colsep'"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:choose>
+        <xsl:when test="$calc.colsep != ''">
+          <xsl:value-of select="$calc.colsep"/>
+        </xsl:when>
+        <xsl:otherwise>0</xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>0</xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="colnum.colspec">
+  <xsl:param name="colnum" select="0"/>
+  <xsl:param name="attribute" select="'colname'"/>
+  <xsl:param name="colspecs" select="ancestor::tgroup/colspec"/>
+  <xsl:param name="count" select="1"/>
+
+  <xsl:choose>
+    <xsl:when test="not($colspecs) or $count &gt; $colnum">
+      <!-- nop -->
+    </xsl:when>
+    <xsl:when test="$colspecs[1]/@colnum">
+      <xsl:choose>
+        <xsl:when test="$colspecs[1]/@colnum = $colnum">
+          <xsl:call-template name="get-attribute">
+            <xsl:with-param name="element" select="$colspecs[1]"/>
+            <xsl:with-param name="attribute" select="$attribute"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="colnum.colspec">
+            <xsl:with-param name="colnum" select="$colnum"/>
+            <xsl:with-param name="attribute" select="$attribute"/>
+            <xsl:with-param name="colspecs"
+                            select="$colspecs[position()&gt;1]"/>
+            <xsl:with-param name="count"
+                            select="$colspecs[1]/@colnum+1"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:choose>
+        <xsl:when test="$count = $colnum">
+          <xsl:call-template name="get-attribute">
+            <xsl:with-param name="element" select="$colspecs[1]"/>
+            <xsl:with-param name="attribute" select="$attribute"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="colnum.colspec">
+            <xsl:with-param name="colnum" select="$colnum"/>
+            <xsl:with-param name="attribute" select="$attribute"/>
+            <xsl:with-param name="colspecs"
+                            select="$colspecs[position()&gt;1]"/>
+            <xsl:with-param name="count" select="$count+1"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="get-attribute">
+  <xsl:param name="element" select="."/>
+  <xsl:param name="attribute" select="''"/>
+
+  <xsl:for-each select="$element/@*">
+    <xsl:if test="local-name(.) = $attribute">
+      <xsl:value-of select="."/>
+    </xsl:if>
+  </xsl:for-each>
+</xsl:template>
+
 </xsl:stylesheet>
index 9c00b11d1fb4fe9ce1ed15395562a476333be1e8..88c8d8c5ced570a90f9044aefb1bc5be3536106f 100644 (file)
 <!ENTITY table.border.style SYSTEM "../params/table.border.style.xml">
 <!ENTITY table.border.color SYSTEM "../params/table.border.color.xml">
 <!ENTITY title.margin.left SYSTEM "../params/title.margin.left.xml">
+<!ENTITY table.entry.padding SYSTEM "../params/table.entry.padding.xml">
index 992bfe8900b05b4dcf0909b4806eb323ddd7adbd..45cf537768df134a37acfc8f78bbe12995320276 100644 (file)
@@ -168,6 +168,7 @@ to be incomplete. Don't forget to read the source, too :-)</para>
 &verbatim.properties;
 &xep.extensions;
 &xref.properties;
+&table.entry.padding;
 &table.border.thickness;
 &table.border.padding;
 &table.border.style;
@@ -305,6 +306,7 @@ around all these parameters.</para>
 <src:fragref linkend="verbatim.properties"/>
 <src:fragref linkend="xep.extensions"/>
 <src:fragref linkend="xref.properties"/>
+<src:fragref linkend="table.entry.padding"/>
 <src:fragref linkend="table.border.thickness"/>
 <src:fragref linkend="table.border.padding"/>
 <src:fragref linkend="table.border.style"/>
index 393f20acda98185769f66ae2ed9009e4f2aa89ae..a684812973f91c88353b5b45617b3d2b3114a506 100644 (file)
@@ -59,8 +59,48 @@ to be incomplete. Don't forget to read the source, too :-)</para>
 <!-- ==================================================================== -->
 
 <xsl:template name="empty.table.cell">
-  <fo:table-cell text-align="center" display-align="center">
-    <fo:block/>
+  <xsl:param name="colnum" select="0"/>
+
+  <xsl:variable name="rowsep">
+    <xsl:call-template name="calculate.rowsep">
+      <xsl:with-param name="entry" select="NOT-AN-ELEMENT-NAME"/>
+      <xsl:with-param name="colnum" select="$colnum"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="colsep">
+    <xsl:call-template name="calculate.colsep">
+      <xsl:with-param name="entry" select="NOT-AN-ELEMENT-NAME"/>
+      <xsl:with-param name="colnum" select="$colnum"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <fo:table-cell text-align="center"
+                 display-align="center"
+                 padding="{$table.border.padding}">
+    <xsl:if test="$colsep &gt; 0">
+      <xsl:call-template name="border">
+        <xsl:with-param name="side" select="'right'"/>
+        <xsl:with-param name="padding" select="1"/>
+      </xsl:call-template>
+    </xsl:if>
+    <!-- don't draw a rowsep on this cell if this row already has one -->
+    <xsl:if test="$rowsep &gt; 0
+                  and ancestor::row[1]/@rowsep != 1">
+      <xsl:call-template name="border">
+        <xsl:with-param name="side" select="'bottom'"/>
+        <xsl:with-param name="padding" select="1"/>
+      </xsl:call-template>
+    </xsl:if>
+    <fo:block>
+      <!--
+      <xsl:text>e(</xsl:text>
+      <xsl:value-of select="$rowsep"/>
+      <xsl:text>,</xsl:text>
+      <xsl:value-of select="$colsep"/>
+      <xsl:text>)</xsl:text>
+      -->
+    </fo:block>
   </fo:table-cell>
 </xsl:template>
 
@@ -70,13 +110,14 @@ to be incomplete. Don't forget to read the source, too :-)</para>
   <xsl:param name="side" select="'left'"/>
   <xsl:param name="padding" select="0"/>
 
-  <xsl:attribute name="border-{$side}">
+  <xsl:attribute name="border-{$side}-width">
     <xsl:value-of select="$table.border.thickness"/>
-    <xsl:text> </xsl:text>
+  </xsl:attribute>
+  <xsl:attribute name="border-{$side}-style">
     <xsl:value-of select="$table.border.style"/>
-    <xsl:text> </xsl:text>
+  </xsl:attribute>
+  <xsl:attribute name="border-{$side}-color">
     <xsl:value-of select="$table.border.color"/>
-    <xsl:text> </xsl:text>
   </xsl:attribute>
   <xsl:if test="$padding != 0">
     <xsl:attribute name="padding-{$side}">
@@ -88,8 +129,6 @@ to be incomplete. Don't forget to read the source, too :-)</para>
 <!-- ==================================================================== -->
 
 <xsl:template match="tgroup">
-  <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
-
   <xsl:variable name="explicit.table.width">
     <xsl:call-template name="dbfo-attribute">
       <xsl:with-param name="pis"
@@ -136,22 +175,15 @@ to be incomplete. Don't forget to read the source, too :-)</para>
     <xsl:when test="$use.extensions != 0
                     and $tablecolumns.extension != 0">
       <xsl:choose>
-        <xsl:when test="contains($vendor, 'SAXON 6')">
+        <xsl:when test="function-available('stbl:adjustColumnWidths')">
           <xsl:copy-of select="stbl:adjustColumnWidths($colspecs)"/>
         </xsl:when>
-        <xsl:when test="contains($vendor, 'SAXON 5')">
-          <!-- the saxon5 extension doesn't support this (yet) -->
-          <xsl:call-template name="generate.colgroup">
-            <xsl:with-param name="cols" select="@cols"/>
-          </xsl:call-template>
-        </xsl:when>
-        <xsl:when test="contains($vendor, 'Apache Software Foundation')">
+        <xsl:when test="function-available('xtbl:adjustColumnWidths')">
           <xsl:copy-of select="xtbl:adjustColumnWidths($colspecs)"/>
         </xsl:when>
         <xsl:otherwise>
           <xsl:message terminate="yes">
-            <xsl:text>Don't know how to do adjust column widths with </xsl:text>
-            <xsl:value-of select="$vendor"/>
+            <xsl:text>No adjustColumnWidths function available.</xsl:text>
           </xsl:message>
         </xsl:otherwise>
       </xsl:choose>
@@ -342,13 +374,24 @@ to be incomplete. Don't forget to read the source, too :-)</para>
 
   <xsl:variable name="empty.cell" select="count(node()) = 0"/>
 
-  <xsl:variable name="entry.colnum">
+  <xsl:variable name="named.colnum">
     <xsl:call-template name="entry.colnum"/>
   </xsl:variable>
 
+  <xsl:variable name="entry.colnum">
+    <xsl:choose>
+      <xsl:when test="$named.colnum &gt; 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="@namest and @nameend">
+      <xsl:when test="@spanname or @namest">
         <xsl:call-template name="calculate.colspan"/>
       </xsl:when>
       <xsl:otherwise>1</xsl:otherwise>
@@ -362,6 +405,20 @@ to be incomplete. Don't forget to read the source, too :-)</para>
     </xsl:call-template>
   </xsl:variable>
 
+  <xsl:variable name="rowsep">
+    <xsl:call-template name="calculate.rowsep">
+      <xsl:with-param name="entry" select="."/>
+      <xsl:with-param name="colnum" select="$entry.colnum"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="colsep">
+    <xsl:call-template name="calculate.colsep">
+      <xsl:with-param name="entry" select="."/>
+      <xsl:with-param name="colnum" select="$entry.colnum"/>
+    </xsl:call-template>
+  </xsl:variable>
+
   <xsl:choose>
     <xsl:when test="$spans != '' and not(starts-with($spans,'0:'))">
       <xsl:call-template name="entry">
@@ -371,7 +428,9 @@ to be incomplete. Don't forget to read the source, too :-)</para>
     </xsl:when>
 
     <xsl:when test="$entry.colnum &gt; $col">
-      <xsl:call-template name="empty.table.cell"/>
+      <xsl:call-template name="empty.table.cell">
+        <xsl:with-param name="colnum" select="$col"/>
+      </xsl:call-template>
       <xsl:call-template name="entry">
         <xsl:with-param name="col" select="$col+1"/>
         <xsl:with-param name="spans" select="substring-after($spans,':')"/>
@@ -379,7 +438,7 @@ to be incomplete. Don't forget to read the source, too :-)</para>
     </xsl:when>
 
     <xsl:otherwise>
-      <fo:table-cell>
+      <fo:table-cell padding="{$table.border.padding}">
         <xsl:call-template name="anchor"/>
 
         <xsl:choose>
@@ -402,13 +461,15 @@ to be incomplete. Don't forget to read the source, too :-)</para>
             </xsl:call-template>
           </xsl:when>
           <xsl:otherwise>
-            <xsl:if test="@colsep='1'">
+            <xsl:if test="$colsep &gt; 0">
               <xsl:call-template name="border">
                 <xsl:with-param name="side" select="'right'"/>
                 <xsl:with-param name="padding" select="1"/>
               </xsl:call-template>
             </xsl:if>
-            <xsl:if test="@rowsep='1'">
+            <!-- don't draw a rowsep on this cell if this row has one -->
+            <xsl:if test="$rowsep &gt; 0
+                          and ancestor::row[1]/@rowsep != 1">
               <xsl:call-template name="border">
                 <xsl:with-param name="side" select="'bottom'"/>
                 <xsl:with-param name="padding" select="1"/>
@@ -461,6 +522,13 @@ to be incomplete. Don't forget to read the source, too :-)</para>
 -->
 
         <fo:block>
+          <!--
+          <xsl:text>(</xsl:text>
+          <xsl:value-of select="$rowsep"/>
+          <xsl:text>,</xsl:text>
+          <xsl:value-of select="$colsep"/>
+          <xsl:text>)</xsl:text>
+          -->
           <xsl:choose>
             <xsl:when test="$empty.cell">
               <xsl:text>&#160;</xsl:text>
@@ -482,6 +550,7 @@ to be incomplete. Don't forget to read the source, too :-)</para>
         <xsl:otherwise>
           <xsl:call-template name="finaltd">
             <xsl:with-param name="spans" select="$following.spans"/>
+            <xsl:with-param name="col" select="$col+$entry.colspan"/>
           </xsl:call-template>
         </xsl:otherwise>
       </xsl:choose>
@@ -499,7 +568,7 @@ to be incomplete. Don't forget to read the source, too :-)</para>
 
   <xsl:variable name="entry.colspan">
     <xsl:choose>
-      <xsl:when test="@namest and @nameend">
+      <xsl:when test="@spanname or @namest">
         <xsl:call-template name="calculate.colspan"/>
       </xsl:when>
       <xsl:otherwise>1</xsl:otherwise>
index 5222c77f8edf147091b3d2037825ae52cdf01eb7..3db540069b1703d353f775ba0f467893e6a86ad7 100644 (file)
 <!ENTITY chunk.datafile SYSTEM "../params/chunk.datafile.xml">
 <!ENTITY saxon.character.representation SYSTEM "../params/saxon.character.representation.xml">
 <!ENTITY generate.legalnotice.link SYSTEM "../params/generate.legalnotice.link.xml">
+
+<!ENTITY table.borders.with.css SYSTEM "../params/table.borders.with.css.xml">
+<!ENTITY table.border.thickness SYSTEM "../params/table.border.thickness.xml">
+<!ENTITY table.border.style SYSTEM "../params/table.border.style.xml">
+<!ENTITY table.border.color SYSTEM "../params/table.border.color.xml">
index 5c58740aa965c04f0224142f0fdfa4c099608af0..196095b9c7a73aac49856c36c0c1daec05888c94 100644 (file)
@@ -180,6 +180,10 @@ to be incomplete. Don't forget to read the source, too :-)</para>
 <reference><title>Tables</title>
 &default.table.width;
 &nominal.table.width;
+&table.borders.with.css;
+&table.border.style;
+&table.border.thickness;
+&table.border.color;
 </reference>
 
 <reference><title>QAndASet</title>
@@ -358,6 +362,10 @@ around all these parameters.</para>
 <src:fragref linkend="use.id.as.filename"/>
 <src:fragref linkend="use.id.function"/>
 <src:fragref linkend="using.chunker"/>
+<src:fragref linkend="table.borders.with.css"/>
+<src:fragref linkend="table.border.thickness"/>
+<src:fragref linkend="table.border.style"/>
+<src:fragref linkend="table.border.color"/>
 
 </xsl:stylesheet>
 </src:fragment>
index a3d9f9be87f32d5a344b9cbc59bc37ed68cf71ab..2931a217b1c6032c8e5f76f02847fcff97e56cd9 100644 (file)
                  functions="adjustColumnWidths"/>
 
 <xsl:template name="empty.table.cell">
-  <td class="auto-generated">&#160;</td>
+  <xsl:param name="colnum" select="0"/>
+
+  <xsl:variable name="rowsep">
+    <xsl:call-template name="calculate.rowsep">
+      <xsl:with-param name="entry" select="NOT-AN-ELEMENT-NAME"/>
+      <xsl:with-param name="colnum" select="$colnum"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="colsep">
+    <xsl:call-template name="calculate.colsep">
+      <xsl:with-param name="entry" select="NOT-AN-ELEMENT-NAME"/>
+      <xsl:with-param name="colnum" select="$colnum"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <td class="auto-generated">
+    <xsl:if test="$table.borders.with.css != 0">
+      <xsl:attribute name="style">
+        <xsl:if test="$colsep &gt; 0">
+          <xsl:call-template name="border">
+            <xsl:with-param name="side" select="'right'"/>
+          </xsl:call-template>
+        </xsl:if>
+        <xsl:if test="$rowsep &gt; 0">
+          <xsl:call-template name="border">
+            <xsl:with-param name="side" select="'bottom'"/>
+          </xsl:call-template>
+        </xsl:if>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:text>&#160;</xsl:text>
+  </td>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="border">
+  <xsl:param name="side" select="'left'"/>
+  <xsl:param name="padding" select="0"/>
+
+  <xsl:text>border-</xsl:text>
+  <xsl:value-of select="$side"/>
+  <xsl:text>: </xsl:text>
+  <xsl:value-of select="$table.border.thickness"/>
+  <xsl:text> </xsl:text>
+  <xsl:value-of select="$table.border.style"/>
+  <xsl:text> </xsl:text>
+  <xsl:value-of select="$table.border.color"/>
+  <xsl:text>; </xsl:text>
 </xsl:template>
 
+<!-- ==================================================================== -->
+
 <xsl:template match="tgroup">
   <table>
     <xsl:choose>
       <xsl:when test="../@frame='none'">
         <xsl:attribute name="border">0</xsl:attribute>
       </xsl:when>
+      <xsl:when test="$table.borders.with.css != 0">
+        <xsl:attribute name="border">0</xsl:attribute>
+        <xsl:choose>
+          <xsl:when test="../@frame='topbot' or ../@frame='top'">
+            <xsl:attribute name="style">
+              <xsl:call-template name="border">
+                <xsl:with-param name="side" select="'top'"/>
+              </xsl:call-template>
+            </xsl:attribute>
+          </xsl:when>
+          <xsl:when test="../@frame='sides'">
+            <xsl:attribute name="style">
+              <xsl:call-template name="border">
+                <xsl:with-param name="side" select="'left'"/>
+              </xsl:call-template>
+              <xsl:call-template name="border">
+                <xsl:with-param name="side" select="'right'"/>
+              </xsl:call-template>
+            </xsl:attribute>
+          </xsl:when>
+        </xsl:choose>
+      </xsl:when>
       <xsl:otherwise>
         <xsl:attribute name="border">1</xsl:attribute>
       </xsl:otherwise>
   <xsl:param name="spans"/>
 
   <tr>
+    <xsl:if test="$table.borders.with.css != 0">
+      <xsl:if test="@rowsep = 1">
+        <xsl:attribute name="style">
+          <xsl:call-template name="border">
+            <xsl:with-param name="side" select="'bottom'"/>
+          </xsl:call-template>
+        </xsl:attribute>
+      </xsl:if>
+    </xsl:if>
+
     <xsl:if test="@align">
       <xsl:attribute name="align">
         <xsl:value-of select="@align"/>
 
   <xsl:variable name="empty.cell" select="count(node()) = 0"/>
 
-  <xsl:variable name="entry.colnum">
+  <xsl:variable name="named.colnum">
     <xsl:call-template name="entry.colnum"/>
   </xsl:variable>
 
+  <xsl:variable name="entry.colnum">
+    <xsl:choose>
+      <xsl:when test="$named.colnum &gt; 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="@namest and @nameend">
+      <xsl:when test="@spanname or @namest">
         <xsl:call-template name="calculate.colspan"/>
       </xsl:when>
       <xsl:otherwise>1</xsl:otherwise>
     </xsl:call-template>
   </xsl:variable>
 
+  <xsl:variable name="rowsep">
+    <xsl:call-template name="calculate.rowsep">
+      <xsl:with-param name="entry" select="."/>
+      <xsl:with-param name="colnum" select="$entry.colnum"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="colsep">
+    <xsl:call-template name="calculate.colsep">
+      <xsl:with-param name="entry" select="."/>
+      <xsl:with-param name="colnum" select="$entry.colnum"/>
+    </xsl:call-template>
+  </xsl:variable>
+
   <xsl:choose>
     <xsl:when test="$spans != '' and not(starts-with($spans,'0:'))">
       <xsl:call-template name="entry">
 
     <xsl:otherwise>
       <xsl:element name="{$cellgi}">
+        <xsl:if test="$table.borders.with.css != 0">
+          <xsl:attribute name="style">
+            <xsl:if test="$colsep &gt; 0">
+              <xsl:call-template name="border">
+                <xsl:with-param name="side" select="'right'"/>
+              </xsl:call-template>
+            </xsl:if>
+            <xsl:if test="$rowsep &gt; 0">
+              <xsl:call-template name="border">
+                <xsl:with-param name="side" select="'bottom'"/>
+              </xsl:call-template>
+            </xsl:if>
+          </xsl:attribute>
+        </xsl:if>
+
         <xsl:if test="@morerows &gt; 0">
           <xsl:attribute name="rowspan">
             <xsl:value-of select="1+@morerows"/>
         <xsl:otherwise>
           <xsl:call-template name="finaltd">
             <xsl:with-param name="spans" select="$following.spans"/>
+            <xsl:with-param name="col" select="$col+$entry.colspan"/>
           </xsl:call-template>
         </xsl:otherwise>
       </xsl:choose>
 
   <xsl:variable name="entry.colspan">
     <xsl:choose>
-      <xsl:when test="@namest and @nameend">
+      <xsl:when test="@spanname or @namest">
         <xsl:call-template name="calculate.colspan"/>
       </xsl:when>
       <xsl:otherwise>1</xsl:otherwise>
diff --git a/xsl/params/table.borders.with.css.xml b/xsl/params/table.borders.with.css.xml
new file mode 100644 (file)
index 0000000..29d02fc
--- /dev/null
@@ -0,0 +1,23 @@
+<refentry>
+<refmeta>
+<refentrytitle>table.borders.with.css</refentrytitle>
+<refmiscinfo role="type">boolean</refmiscinfo>
+</refmeta>
+<refnamediv>
+<refname>table.borders.with.css</refname>
+<refpurpose>Use CSS to specify table, row, and cell borders?</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+<src:fragment id="table.borders.with.css">
+<xsl:param name="table.borders.with.css" select="0"/>
+</src:fragment>
+</refsynopsisdiv>
+
+<refsect1><title>Description</title>
+
+<para>If true (non-zero), CSS will be used to draw table borders.
+</para>
+
+</refsect1>
+</refentry>
diff --git a/xsl/params/table.entry.padding.xml b/xsl/params/table.entry.padding.xml
new file mode 100644 (file)
index 0000000..a065d6a
--- /dev/null
@@ -0,0 +1,22 @@
+<refentry>
+<refmeta>
+<refentrytitle>table.entry.padding</refentrytitle>
+<refmiscinfo role="type"></refmiscinfo>
+</refmeta>
+<refnamediv>
+<refname>table.entry.padding</refname>
+<refpurpose></refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+<src:fragment id="table.entry.padding">
+<xsl:param name="table.entry.padding" select="'2pt'"/>
+</src:fragment>
+</refsynopsisdiv>
+
+<refsect1><title>Description</title>
+
+<para>FIXME:</para>
+
+</refsect1>
+</refentry>