]> granicus.if.org Git - docbook-dsssl/commitdiff
Added header.column.widths and footer.column.widths to
authorBob Stayton <bobs@sagehill.net>
Mon, 26 Jan 2004 07:12:38 +0000 (07:12 +0000)
committerBob Stayton <bobs@sagehill.net>
Mon, 26 Jan 2004 07:12:38 +0000 (07:12 +0000)
permit adjustment of the header and footer widths.

xsl/fo/pagesetup.xsl
xsl/fo/param.ent
xsl/fo/param.xweb

index de1a698281bfd6e163acc28f76ba6019aa3f8731..49f21fe89b39eaa5285de1620b72a15a06d895b7 100644 (file)
       </xsl:when>
   </xsl:choose>
 
+  <xsl:variable name="column1">
+    <xsl:choose>
+      <xsl:when test="$sequence = 'first' or $sequence = 'odd'">1</xsl:when>
+      <xsl:otherwise>3</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="column3">
+    <xsl:choose>
+      <xsl:when test="$sequence = 'first' or $sequence = 'odd'">3</xsl:when>
+      <xsl:otherwise>1</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
   <xsl:variable name="candidate">
     <fo:table table-layout="fixed" width="100%">
       <xsl:call-template name="head.sep.rule">
         <xsl:with-param name="gentext-key" select="$gentext-key"/>
       </xsl:call-template>
 
-      <fo:table-column column-number="1" column-width="proportional-column-width(1)"/>
-      <fo:table-column column-number="2" column-width="proportional-column-width(1)"/>
-      <fo:table-column column-number="3" column-width="proportional-column-width(1)"/>
+      <fo:table-column column-number="1">
+        <xsl:attribute name="column-width">
+          <xsl:text>proportional-column-width(</xsl:text>
+          <xsl:call-template name="header.footer.width">
+            <xsl:with-param name="location">header</xsl:with-param>
+            <xsl:with-param name="position" select="$column1"/>
+          </xsl:call-template>
+          <xsl:text>)</xsl:text>
+        </xsl:attribute>
+      </fo:table-column>
+      <fo:table-column column-number="2">
+        <xsl:attribute name="column-width">
+          <xsl:text>proportional-column-width(</xsl:text>
+          <xsl:call-template name="header.footer.width">
+            <xsl:with-param name="location">header</xsl:with-param>
+            <xsl:with-param name="position" select="2"/>
+          </xsl:call-template>
+          <xsl:text>)</xsl:text>
+        </xsl:attribute>
+      </fo:table-column>
+      <fo:table-column column-number="3">
+        <xsl:attribute name="column-width">
+          <xsl:text>proportional-column-width(</xsl:text>
+          <xsl:call-template name="header.footer.width">
+            <xsl:with-param name="location">header</xsl:with-param>
+            <xsl:with-param name="position" select="$column3"/>
+          </xsl:call-template>
+          <xsl:text>)</xsl:text>
+        </xsl:attribute>
+      </fo:table-column>
+
       <fo:table-body>
         <fo:table-row height="14pt">
           <fo:table-cell text-align="left"
   </fo:block>
 </xsl:template>
 
+<xsl:template name="header.footer.width">
+  <xsl:param name="location" select="'header'"/>
+  <xsl:param name="position" select="1"/>
+
+  <xsl:variable name="width.set">
+    <xsl:choose>
+      <xsl:when test="$location = 'header'">
+        <xsl:value-of select="normalize-space($header.column.widths)"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="normalize-space($footer.column.widths)"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+
+  <xsl:variable name="width">
+    <xsl:choose>
+      <xsl:when test="$position = 1">
+        <xsl:value-of select="substring-before($width.set, ' ')"/>
+      </xsl:when>
+      <xsl:when test="$position = 2">
+        <xsl:value-of select="substring-before(substring-after($width.set, ' '), ' ')"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="substring-after(substring-after($width.set, ' '), ' ')"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <!-- Make sure it is a number -->
+  <xsl:choose>
+    <xsl:when test = "$width = number($width)">
+      <xsl:value-of select="$width"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:message>Error: value in <xsl:value-of select="$location"/>.column.widths at position <xsl:value-of select="$position"/> is not a number.</xsl:message>
+      <xsl:text>1</xsl:text>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
 <xsl:template name="draft.text">
   <xsl:choose>
     <xsl:when test="$draft.mode = 'yes'">
   <xsl:param name="sequence" select="''"/>
   <xsl:param name="gentext-key" select="''"/>
 
+  <!-- default is a single table style for all footers -->
+  <!-- Customize it for different page classes or sequence location -->
+
   <xsl:choose>
       <xsl:when test="$pageclass = 'index'">
           <xsl:attribute name="margin-left">0pt</xsl:attribute>
       </xsl:when>
   </xsl:choose>
 
-  <!-- default is a single table style for all footers -->
-  <!-- Customize it for different page classes or sequence location -->
+  <xsl:variable name="column1">
+    <xsl:choose>
+      <xsl:when test="$sequence = 'first' or $sequence = 'odd'">1</xsl:when>
+      <xsl:otherwise>3</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="column3">
+    <xsl:choose>
+      <xsl:when test="$sequence = 'first' or $sequence = 'odd'">3</xsl:when>
+      <xsl:otherwise>1</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
 
   <xsl:variable name="candidate">
     <fo:table table-layout="fixed" width="100%">
         <xsl:with-param name="sequence" select="$sequence"/>
         <xsl:with-param name="gentext-key" select="$gentext-key"/>
       </xsl:call-template>
-      <fo:table-column column-number="1" column-width="proportional-column-width(1)"/>
-      <fo:table-column column-number="2" column-width="proportional-column-width(1)"/>
-      <fo:table-column column-number="3" column-width="proportional-column-width(1)"/>
+      <fo:table-column column-number="1">
+        <xsl:attribute name="column-width">
+          <xsl:text>proportional-column-width(</xsl:text>
+          <xsl:call-template name="header.footer.width">
+            <xsl:with-param name="location">footer</xsl:with-param>
+            <xsl:with-param name="position" select="$column1"/>
+          </xsl:call-template>
+          <xsl:text>)</xsl:text>
+        </xsl:attribute>
+      </fo:table-column>
+      <fo:table-column column-number="2">
+        <xsl:attribute name="column-width">
+          <xsl:text>proportional-column-width(</xsl:text>
+          <xsl:call-template name="header.footer.width">
+            <xsl:with-param name="location">footer</xsl:with-param>
+            <xsl:with-param name="position" select="2"/>
+          </xsl:call-template>
+          <xsl:text>)</xsl:text>
+        </xsl:attribute>
+      </fo:table-column>
+      <fo:table-column column-number="3">
+        <xsl:attribute name="column-width">
+          <xsl:text>proportional-column-width(</xsl:text>
+          <xsl:call-template name="header.footer.width">
+            <xsl:with-param name="location">footer</xsl:with-param>
+            <xsl:with-param name="position" select="$column3"/>
+          </xsl:call-template>
+          <xsl:text>)</xsl:text>
+        </xsl:attribute>
+      </fo:table-column>
+
       <fo:table-body>
         <fo:table-row height="14pt">
           <fo:table-cell text-align="left"
index 17b34e5798de7bca0ae06671412fdd4ff9e1e8cb..010f8a2bfe217c3a02cf6f33a2948a23602fda25 100644 (file)
@@ -46,6 +46,7 @@
 <!ENTITY draft.watermark.image SYSTEM "../params/draft.watermark.image.xml">
 <!ENTITY firstterm.only.link SYSTEM "../params/firstterm.only.link.xml">
 <!ENTITY footer.rule SYSTEM "../params/footer.rule.xml">
+<!ENTITY footer.column.widths SYSTEM "../params/footer.column.widths.xml">
 <!ENTITY footers.on.blank.pages SYSTEM "../params/footers.on.blank.pages.xml">
 <!ENTITY footnote.font.size SYSTEM "../params/footnote.font.size.xml">
 <!ENTITY fop.extensions SYSTEM "../params/fop.extensions.xml">
@@ -66,6 +67,7 @@
 <!ENTITY glossterm.width SYSTEM "../params/glossterm.width.xml">
 <!ENTITY graphic.default.extension SYSTEM "../params/graphic.default.extension.xml">
 <!ENTITY header.rule SYSTEM "../params/header.rule.xml">
+<!ENTITY header.column.widths SYSTEM "../params/header.column.widths.xml">
 <!ENTITY headers.on.blank.pages SYSTEM "../params/headers.on.blank.pages.xml">
 <!ENTITY hyphenate SYSTEM "../params/hyphenate.xml">
 <!ENTITY informal.object.properties SYSTEM "../params/informal.object.properties.xml">
index 37891f500ed258d2748bb8b7bb7ef5b505c1ffc8..027e21b2c73238194c3dd72b125f77afc2e6864d 100644 (file)
@@ -349,6 +349,8 @@ zero by default, so this is simply the page-master region-left.
 &footers.on.blank.pages;
 &header.rule;
 &footer.rule;
+&header.column.widths;
+&footer.column.widths;
 &header.content.properties;
 &footer.content.properties;
 &marker.section.level;
@@ -541,6 +543,7 @@ around all these parameters.</para>
 <src:fragref linkend="firstterm.only.link.frag"/>
 <src:fragref linkend="footer.content.properties.frag"/>
 <src:fragref linkend="footer.rule.frag"/>
+<src:fragref linkend="footer.column.widths.frag"/>
 <src:fragref linkend="footers.on.blank.pages.frag"/>
 <src:fragref linkend="footnote.font.size.frag"/>
 <src:fragref linkend="footnote.number.format.frag"/>
@@ -566,6 +569,7 @@ around all these parameters.</para>
 <src:fragref linkend="graphic.default.extension.frag"/>
 <src:fragref linkend="header.content.properties.frag"/>
 <src:fragref linkend="header.rule.frag"/>
+<src:fragref linkend="header.column.widths.frag"/>
 <src:fragref linkend="headers.on.blank.pages.frag"/>
 <src:fragref linkend="hyphenate.frag"/>
 <src:fragref linkend="ignore.image.scaling.frag"/>