]> granicus.if.org Git - docbook-dsssl/commitdiff
Support bgcolor PI in table cells; make sure rowsep and colsep don't have any effect...
authorNorman Walsh <ndw@nwalsh.com>
Sat, 12 Apr 2003 21:01:58 +0000 (21:01 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Sat, 12 Apr 2003 21:01:58 +0000 (21:01 +0000)
xsl/fo/table.xsl

index ec04b68764b440d7724a25728be2b741ccebd223..d60b109b13cd70f20b826c2394d5a945c114c69d 100644 (file)
@@ -63,21 +63,37 @@ to be incomplete. Don't forget to read the source, too :-)</para>
   <xsl:param name="colnum" select="0"/>
 
   <xsl:variable name="rowsep">
-    <xsl:call-template name="inherited.table.attribute">
-      <xsl:with-param name="entry" select="NOT-AN-ELEMENT-NAME"/>
-      <xsl:with-param name="row" select="ancestor-or-self::row[1]"/>
-      <xsl:with-param name="colnum" select="$colnum"/>
-      <xsl:with-param name="attribute" select="'rowsep'"/>
-    </xsl:call-template>
+    <xsl:choose>
+      <!-- If this is the last row, rowsep never applies. -->
+      <xsl:when test="not(ancestor-or-self::row/following-sibling::row
+                          or ancestor-or-self::thead/following-sibling::tbody
+                          or ancestor-or-self::tbody/preceding-sibling::tfoot)">
+        <xsl:value-of select="0"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="inherited.table.attribute">
+          <xsl:with-param name="entry" select="NOT-AN-ELEMENT-NAME"/>
+          <xsl:with-param name="row" select="ancestor-or-self::row[1]"/>
+          <xsl:with-param name="colnum" select="$colnum"/>
+          <xsl:with-param name="attribute" select="'rowsep'"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
   </xsl:variable>
 
   <xsl:variable name="colsep">
-    <xsl:call-template name="inherited.table.attribute">
-      <xsl:with-param name="entry" select="NOT-AN-ELEMENT-NAME"/>
-      <xsl:with-param name="row" select="ancestor-or-self::row[1]"/>
-      <xsl:with-param name="colnum" select="$colnum"/>
-      <xsl:with-param name="attribute" select="'colsep'"/>
-    </xsl:call-template>
+    <xsl:choose>
+      <!-- If this is the last column, colsep never applies. -->
+      <xsl:when test="$colnum &gt;= ancestor::tgroup/@cols">0</xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="inherited.table.attribute">
+          <xsl:with-param name="entry" select="NOT-AN-ELEMENT-NAME"/>
+          <xsl:with-param name="row" select="ancestor-or-self::row[1]"/>
+          <xsl:with-param name="colnum" select="$colnum"/>
+          <xsl:with-param name="attribute" select="'colsep'"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
   </xsl:variable>
 
   <fo:table-cell text-align="center"
@@ -312,12 +328,34 @@ to be incomplete. Don't forget to read the source, too :-)</para>
     </xsl:call-template>
   </xsl:variable>
 
+  <xsl:variable name="more.cols.str">
+    <xsl:choose>
+      <xsl:when test="following-sibling::entry|following-sibling::entrytbl">X</xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="has-more-td">
+          <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>
+
   <xsl:variable name="rowsep">
-    <xsl:call-template name="inherited.table.attribute">
-      <xsl:with-param name="entry" select="."/>
-      <xsl:with-param name="colnum" select="$entry.colnum"/>
-      <xsl:with-param name="attribute" select="'rowsep'"/>
-    </xsl:call-template>
+    <xsl:choose>
+      <!-- If this is the last row, rowsep never applies. -->
+      <xsl:when test="not(ancestor-or-self::row/following-sibling::row
+                          or ancestor-or-self::thead/following-sibling::tbody
+                          or ancestor-or-self::tbody/preceding-sibling::tfoot)">
+        <xsl:value-of select="0"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="inherited.table.attribute">
+          <xsl:with-param name="entry" select="."/>
+          <xsl:with-param name="colnum" select="$entry.colnum"/>
+          <xsl:with-param name="attribute" select="'rowsep'"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
   </xsl:variable>
 
 <!--
@@ -325,11 +363,17 @@ to be incomplete. Don't forget to read the source, too :-)</para>
 -->
 
   <xsl:variable name="colsep">
-    <xsl:call-template name="inherited.table.attribute">
-      <xsl:with-param name="entry" select="."/>
-      <xsl:with-param name="colnum" select="$entry.colnum"/>
-      <xsl:with-param name="attribute" select="'colsep'"/>
-    </xsl:call-template>
+    <xsl:choose>
+      <!-- If this is the last column, colsep never applies. -->
+      <xsl:when test="$more.cols.str = ''">0</xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="inherited.table.attribute">
+          <xsl:with-param name="entry" select="."/>
+          <xsl:with-param name="colnum" select="$entry.colnum"/>
+          <xsl:with-param name="attribute" select="'colsep'"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
   </xsl:variable>
 
   <xsl:variable name="valign">
@@ -485,12 +529,26 @@ to be incomplete. Don't forget to read the source, too :-)</para>
         </xsl:choose>
       </xsl:variable>
 
+      <xsl:variable name="bgcolor">
+        <xsl:call-template name="dbfo-attribute">
+          <xsl:with-param name="pis"
+                          select="ancestor-or-self::entry/processing-instruction('dbfo')"/>
+          <xsl:with-param name="attribute" select="'bgcolor'"/>
+        </xsl:call-template>
+      </xsl:variable>
+
       <fo:table-cell xsl:use-attribute-sets="table.cell.padding">
         <xsl:if test="$xep.extensions != 0">
           <!-- Suggested by RenderX to workaround a bug in their implementation -->
           <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
         </xsl:if>
 
+        <xsl:if test="$bgcolor != ''">
+          <xsl:attribute name="background-color">
+            <xsl:value-of select="$bgcolor"/>
+          </xsl:attribute>
+        </xsl:if>
+
         <xsl:call-template name="anchor"/>
 
         <xsl:if test="$rowsep &gt; 0">