]> granicus.if.org Git - docbook-dsssl/commitdiff
Moved table frame code to a common named template; handle frame=none
authorNorman Walsh <ndw@nwalsh.com>
Sat, 10 Nov 2001 15:04:07 +0000 (15:04 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Sat, 10 Nov 2001 15:04:07 +0000 (15:04 +0000)
xsl/fo/formal.xsl

index ecab312db7938535e1a2d7ff33c1589279ee72b4..743267f998efab2b8bef6f0d7cc59611b7eaf19b 100644 (file)
   <xsl:call-template name="formal.object"/>
 </xsl:template>
 
+<xsl:template name="table.frame">
+  <xsl:variable name="frame">
+    <xsl:choose>
+      <xsl:when test="@frame">
+        <xsl:value-of select="@frame"/>
+      </xsl:when>
+      <xsl:otherwise>all</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$frame='all'">
+      <xsl:attribute name="border-left-style">solid</xsl:attribute>
+      <xsl:attribute name="border-right-style">solid</xsl:attribute>
+      <xsl:attribute name="border-top-style">solid</xsl:attribute>
+      <xsl:attribute name="border-bottom-style">solid</xsl:attribute>
+    </xsl:when>
+    <xsl:when test="$frame='bottom'">
+      <xsl:attribute name="border-left-style">none</xsl:attribute>
+      <xsl:attribute name="border-right-style">none</xsl:attribute>
+      <xsl:attribute name="border-top-style">none</xsl:attribute>
+      <xsl:attribute name="border-bottom-style">solid</xsl:attribute>
+    </xsl:when>
+    <xsl:when test="$frame='sides'">
+      <xsl:attribute name="border-left-style">solid</xsl:attribute>
+      <xsl:attribute name="border-right-style">solid</xsl:attribute>
+      <xsl:attribute name="border-top-style">none</xsl:attribute>
+      <xsl:attribute name="border-bottom-style">none</xsl:attribute>
+    </xsl:when>
+    <xsl:when test="$frame='top'">
+      <xsl:attribute name="border-left-style">none</xsl:attribute>
+      <xsl:attribute name="border-right-style">none</xsl:attribute>
+      <xsl:attribute name="border-top-style">solid</xsl:attribute>
+      <xsl:attribute name="border-bottom-style">none</xsl:attribute>
+    </xsl:when>
+    <xsl:when test="$frame='topbot'">
+      <xsl:attribute name="border-left-style">none</xsl:attribute>
+      <xsl:attribute name="border-right-style">none</xsl:attribute>
+      <xsl:attribute name="border-top-style">solid</xsl:attribute>
+      <xsl:attribute name="border-bottom-style">solid</xsl:attribute>
+    </xsl:when>
+    <xsl:when test="$frame='none'">
+      <xsl:attribute name="border-left-style">none</xsl:attribute>
+      <xsl:attribute name="border-right-style">none</xsl:attribute>
+      <xsl:attribute name="border-top-style">none</xsl:attribute>
+      <xsl:attribute name="border-bottom-style">none</xsl:attribute>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:message>
+        <xsl:text>Impossible frame on table: </xsl:text>
+        <xsl:value-of select="$frame"/>
+      </xsl:message>
+      <xsl:attribute name="border-left-style">none</xsl:attribute>
+      <xsl:attribute name="border-right-style">none</xsl:attribute>
+      <xsl:attribute name="border-top-style">none</xsl:attribute>
+      <xsl:attribute name="border-bottom-style">none</xsl:attribute>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
 <xsl:template match="table">
   <xsl:variable name="id">
     <xsl:call-template name="object.id"/>
         </fo:block>
       </fo:table-caption>
       <fo:table>
-        <xsl:variable name="frame">
-          <xsl:choose>
-            <xsl:when test="@frame">
-              <xsl:value-of select="@frame"/>
-            </xsl:when>
-            <xsl:otherwise>all</xsl:otherwise>
-          </xsl:choose>
-        </xsl:variable>
-
-        <xsl:choose>
-          <xsl:when test="$frame='all'">
-            <xsl:attribute name="border-left-style">solid</xsl:attribute>
-            <xsl:attribute name="border-right-style">solid</xsl:attribute>
-            <xsl:attribute name="border-top-style">solid</xsl:attribute>
-            <xsl:attribute name="border-bottom-style">solid</xsl:attribute>
-          </xsl:when>
-          <xsl:when test="$frame='bottom'">
-            <xsl:attribute name="border-left-style">none</xsl:attribute>
-            <xsl:attribute name="border-right-style">none</xsl:attribute>
-            <xsl:attribute name="border-top-style">none</xsl:attribute>
-            <xsl:attribute name="border-bottom-style">solid</xsl:attribute>
-          </xsl:when>
-          <xsl:when test="$frame='sides'">
-            <xsl:attribute name="border-left-style">solid</xsl:attribute>
-            <xsl:attribute name="border-right-style">solid</xsl:attribute>
-            <xsl:attribute name="border-top-style">none</xsl:attribute>
-            <xsl:attribute name="border-bottom-style">none</xsl:attribute>
-          </xsl:when>
-          <xsl:when test="$frame='top'">
-            <xsl:attribute name="border-left-style">none</xsl:attribute>
-            <xsl:attribute name="border-right-style">none</xsl:attribute>
-            <xsl:attribute name="border-top-style">solid</xsl:attribute>
-            <xsl:attribute name="border-bottom-style">none</xsl:attribute>
-          </xsl:when>
-          <xsl:when test="$frame='topbot'">
-            <xsl:attribute name="border-left-style">none</xsl:attribute>
-            <xsl:attribute name="border-right-style">none</xsl:attribute>
-            <xsl:attribute name="border-top-style">solid</xsl:attribute>
-            <xsl:attribute name="border-bottom-style">solid</xsl:attribute>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:message>
-              <xsl:text>Impossible frame on table: </xsl:text>
-              <xsl:value-of select="$frame"/>
-            </xsl:message>
-            <xsl:attribute name="border-left-style">none</xsl:attribute>
-            <xsl:attribute name="border-right-style">none</xsl:attribute>
-            <xsl:attribute name="border-top-style">none</xsl:attribute>
-            <xsl:attribute name="border-bottom-style">none</xsl:attribute>
-          </xsl:otherwise>
-        </xsl:choose>
-
+        <xsl:call-template name="table.frame"/>
         <xsl:if test="count($prop-columns) != 0">
           <xsl:attribute name="table-layout">fixed</xsl:attribute>
         </xsl:if>
     </xsl:attribute>
 
     <fo:table>
-      <xsl:variable name="frame">
-        <xsl:choose>
-          <xsl:when test="@frame">
-            <xsl:value-of select="@frame"/>
-          </xsl:when>
-          <xsl:otherwise>all</xsl:otherwise>
-        </xsl:choose>
-      </xsl:variable>
-
-      <xsl:choose>
-        <xsl:when test="$frame='all'">
-          <xsl:attribute name="border-left-style">solid</xsl:attribute>
-          <xsl:attribute name="border-right-style">solid</xsl:attribute>
-          <xsl:attribute name="border-top-style">solid</xsl:attribute>
-          <xsl:attribute name="border-bottom-style">solid</xsl:attribute>
-        </xsl:when>
-        <xsl:when test="$frame='bottom'">
-          <xsl:attribute name="border-left-style">none</xsl:attribute>
-          <xsl:attribute name="border-right-style">none</xsl:attribute>
-          <xsl:attribute name="border-top-style">none</xsl:attribute>
-          <xsl:attribute name="border-bottom-style">solid</xsl:attribute>
-        </xsl:when>
-        <xsl:when test="$frame='sides'">
-          <xsl:attribute name="border-left-style">solid</xsl:attribute>
-          <xsl:attribute name="border-right-style">solid</xsl:attribute>
-          <xsl:attribute name="border-top-style">none</xsl:attribute>
-          <xsl:attribute name="border-bottom-style">none</xsl:attribute>
-        </xsl:when>
-        <xsl:when test="$frame='top'">
-          <xsl:attribute name="border-left-style">none</xsl:attribute>
-          <xsl:attribute name="border-right-style">none</xsl:attribute>
-          <xsl:attribute name="border-top-style">solid</xsl:attribute>
-          <xsl:attribute name="border-bottom-style">none</xsl:attribute>
-        </xsl:when>
-        <xsl:when test="$frame='topbot'">
-          <xsl:attribute name="border-left-style">none</xsl:attribute>
-          <xsl:attribute name="border-right-style">none</xsl:attribute>
-          <xsl:attribute name="border-top-style">solid</xsl:attribute>
-          <xsl:attribute name="border-bottom-style">solid</xsl:attribute>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:message>
-            <xsl:text>Impossible frame on informaltable: </xsl:text>
-            <xsl:value-of select="$frame"/>
-          </xsl:message>
-          <xsl:attribute name="border-left-style">none</xsl:attribute>
-          <xsl:attribute name="border-right-style">none</xsl:attribute>
-          <xsl:attribute name="border-top-style">none</xsl:attribute>
-          <xsl:attribute name="border-bottom-style">none</xsl:attribute>
-        </xsl:otherwise>
-      </xsl:choose>
-
+      <xsl:call-template name="table.frame"/>
       <xsl:if test="count($prop-columns) != 0">
         <xsl:attribute name="table-layout">fixed</xsl:attribute>
       </xsl:if>