]> granicus.if.org Git - docbook-dsssl/commitdiff
Add support for HTML markup table border attribute, applied to each table cell.
authorBob Stayton <bobs@sagehill.net>
Tue, 31 May 2005 01:04:00 +0000 (01:04 +0000)
committerBob Stayton <bobs@sagehill.net>
Tue, 31 May 2005 01:04:00 +0000 (01:04 +0000)
xsl/fo/table.xsl

index bb75acc56b2cf5f03bbc56035c5f81d58a60f151..5f36723cad0107b82da5d245af66c5e942074e71 100644 (file)
@@ -655,54 +655,73 @@ to be incomplete. Don't forget to read the source, too :-)</para>
   <xsl:param name="align.inherit" select="''"/>
   <xsl:param name="char.inherit" select="''"/>
 
-        <xsl:if test="$bgcolor.pi != ''">
-          <xsl:attribute name="background-color">
-            <xsl:value-of select="$bgcolor.pi"/>
-          </xsl:attribute>
-        </xsl:if>
-
-        <xsl:if test="$rowsep.inherit &gt; 0">
-          <xsl:call-template name="border">
-            <xsl:with-param name="side" select="'bottom'"/>
-          </xsl:call-template>
-        </xsl:if>
+  <xsl:choose>
+    <xsl:when test="ancestor::tgroup">
+      <xsl:if test="$bgcolor.pi != ''">
+        <xsl:attribute name="background-color">
+          <xsl:value-of select="$bgcolor.pi"/>
+        </xsl:attribute>
+      </xsl:if>
+
+      <xsl:if test="$rowsep.inherit &gt; 0">
+        <xsl:call-template name="border">
+          <xsl:with-param name="side" select="'bottom'"/>
+        </xsl:call-template>
+      </xsl:if>
 
-        <xsl:if test="$colsep.inherit &gt; 0 and 
+      <xsl:if test="$colsep.inherit &gt; 0 and 
                      $col &lt; ancestor::tgroup/@cols">
-          <xsl:call-template name="border">
-            <xsl:with-param name="side" select="'right'"/>
-          </xsl:call-template>
-        </xsl:if>
-
-        <xsl:if test="$valign.inherit != ''">
-          <xsl:attribute name="display-align">
-            <xsl:choose>
-              <xsl:when test="$valign.inherit='top'">before</xsl:when>
-              <xsl:when test="$valign.inherit='middle'">center</xsl:when>
-              <xsl:when test="$valign.inherit='bottom'">after</xsl:when>
-              <xsl:otherwise>
-                <xsl:message>
-                  <xsl:text>Unexpected valign value: </xsl:text>
-                  <xsl:value-of select="$valign.inherit"/>
-                  <xsl:text>, center used.</xsl:text>
-                </xsl:message>
-                <xsl:text>center</xsl:text>
-              </xsl:otherwise>
-            </xsl:choose>
-          </xsl:attribute>
-        </xsl:if>
-
-        <xsl:if test="$align.inherit != ''">
-          <xsl:attribute name="text-align">
-            <xsl:value-of select="$align.inherit"/>
-          </xsl:attribute>
-        </xsl:if>
+        <xsl:call-template name="border">
+          <xsl:with-param name="side" select="'right'"/>
+        </xsl:call-template>
+      </xsl:if>
 
-        <xsl:if test="$char.inherit != ''">
-          <xsl:attribute name="text-align">
-            <xsl:value-of select="$char.inherit"/>
-          </xsl:attribute>
-        </xsl:if>
+      <xsl:if test="$valign.inherit != ''">
+        <xsl:attribute name="display-align">
+          <xsl:choose>
+            <xsl:when test="$valign.inherit='top'">before</xsl:when>
+            <xsl:when test="$valign.inherit='middle'">center</xsl:when>
+            <xsl:when test="$valign.inherit='bottom'">after</xsl:when>
+            <xsl:otherwise>
+              <xsl:message>
+                <xsl:text>Unexpected valign value: </xsl:text>
+                <xsl:value-of select="$valign.inherit"/>
+                <xsl:text>, center used.</xsl:text>
+              </xsl:message>
+              <xsl:text>center</xsl:text>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:attribute>
+      </xsl:if>
+
+      <xsl:if test="$align.inherit != ''">
+        <xsl:attribute name="text-align">
+          <xsl:value-of select="$align.inherit"/>
+        </xsl:attribute>
+      </xsl:if>
+
+      <xsl:if test="$char.inherit != ''">
+        <xsl:attribute name="text-align">
+          <xsl:value-of select="$char.inherit"/>
+        </xsl:attribute>
+      </xsl:if>
+    </xsl:when>
+    <xsl:otherwise>
+      <!-- HTML table -->
+      <xsl:variable name="border" 
+                    select="(ancestor::table |
+                             ancestor::informaltable)[last()]/@border"/>
+      <xsl:if test="$border != '' and $border != 0">
+        <xsl:attribute name="border">
+          <xsl:value-of select="$table.cell.border.thickness"/>
+          <xsl:text> </xsl:text>
+          <xsl:value-of select="$table.cell.border.style"/>
+          <xsl:text> </xsl:text>
+          <xsl:value-of select="$table.cell.border.color"/>
+        </xsl:attribute>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
 
 </xsl:template>