]> granicus.if.org Git - docbook-dsssl/commitdiff
Don't output viewport table if it isn't going to do anything useful
authorNorman Walsh <ndw@nwalsh.com>
Tue, 11 Jun 2002 13:59:23 +0000 (13:59 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Tue, 11 Jun 2002 13:59:23 +0000 (13:59 +0000)
xsl/html/graphics.xsl

index 2896a29ea697a28f024cf170cbb16a83d4594608..9d7e2127d45ca655dfd3ef6f321973e9a4f81858 100644 (file)
@@ -488,9 +488,24 @@ valign: <xsl:value-of select="@valign"/></xsl:message>
     </xsl:choose>
   </xsl:variable>
 
+
+  <xsl:variable name="bgcolor">
+    <xsl:call-template name="dbhtml-attribute">
+      <xsl:with-param name="pis"
+                      select="../processing-instruction('dbhtml')"/>
+      <xsl:with-param name="attribute" select="'background-color'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="use.viewport"
+                select="$viewport != 0
+                        and ($html.width != ''
+                             or ($html.depth != '' and $depth-units != '%')
+                             or $bgcolor != ''
+                             or @valign)"/>
+
   <xsl:choose>
-    <!-- tables and alignment don't play nicely; skip the table if align is set -->
-    <xsl:when test="$viewport != 0 and not(@align)">
+    <xsl:when test="$use.viewport">
       <table border="0" summary="manufactured viewport for HTML img"
              cellspacing="0" cellpadding="0">
         <xsl:if test="$html.width != ''">
@@ -506,13 +521,6 @@ valign: <xsl:value-of select="@valign"/></xsl:message>
             </xsl:attribute>
           </xsl:if>
           <td>
-            <xsl:variable name="bgcolor">
-              <xsl:call-template name="dbhtml-attribute">
-                <xsl:with-param name="pis"
-                                select="../processing-instruction('dbhtml')"/>
-                <xsl:with-param name="attribute" select="'background-color'"/>
-              </xsl:call-template>
-            </xsl:variable>
             <xsl:if test="$bgcolor != ''">
               <xsl:attribute name="bgcolor">
                 <xsl:value-of select="$bgcolor"/>