]> granicus.if.org Git - docbook-dsssl/commitdiff
Support bgcolor (instead of entry-bgcolor) PI in table cells; make sure rowsep and...
authorNorman Walsh <ndw@nwalsh.com>
Sat, 12 Apr 2003 21:09:48 +0000 (21:09 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Sat, 12 Apr 2003 21:09:48 +0000 (21:09 +0000)
xsl/html/table.xsl

index 38084265c67dd087a0380a8431c0d85df7ce2ea1..7895f4a37b47edaa76f49dbce6d5118e3a423746 100644 (file)
   <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>
 
   <td class="auto-generated">
           </xsl:otherwise>
         </xsl:choose>
       </xsl:when>
-      <xsl:when test="../@frame='none'">
+      <xsl:when test="../@frame='none' or local-name(.) = 'entrytbl'">
         <xsl:attribute name="border">0</xsl:attribute>
       </xsl:when>
       <xsl:otherwise>
     </xsl:if>
 
     <xsl:if test="$table.borders.with.css != 0">
-      <xsl:if test="@rowsep = 1">
+      <xsl:if test="@rowsep = 1 and following-sibling::row">
         <xsl:attribute name="style">
           <xsl:call-template name="border">
             <xsl:with-param name="side" select="'bottom'"/>
     </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>
 
   <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">
     </xsl:when>
 
     <xsl:otherwise>
-      <xsl:variable name="entry-bgcolor">
+      <xsl:variable name="bgcolor">
         <xsl:if test="processing-instruction('dbhtml')">
           <xsl:call-template name="dbhtml-attribute">
             <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
-            <xsl:with-param name="attribute" select="'entry-bgcolor'"/>
+            <xsl:with-param name="attribute" select="'bgcolor'"/>
           </xsl:call-template>
         </xsl:if>
       </xsl:variable>
 
       <xsl:element name="{$cellgi}">
-        <xsl:if test="$entry-bgcolor != ''">
+        <xsl:if test="$bgcolor != ''">
           <xsl:attribute name="bgcolor">
-            <xsl:value-of select="$entry-bgcolor"/>
+            <xsl:value-of select="$bgcolor"/>
           </xsl:attribute>
         </xsl:if>