OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] help please. fo output, header and footer?


Title: Re: [docbook-apps] help please. fo output, header and foot
Dave
As far as I can remember the commented out stuff was just part of development and contributes nothing but errors, but it was some time ago.  The active stuff does not do the following
<!-- Customize the header content, book title centered on even, chapter title on odd pages  -->
I should have removed that comment.
I have 2 stylesheets, one to generate double-spaced single-sided MS output that editors like, and the other, attached below, to generate book-like double-sided, single-spaced output.  I sent you the MS one, the book-like one is below - probably nearer to what you want.
Ron
PS Did we meet in the early 1990s, I seem to remember you were at RNIB while I was at ICRF?


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:xsl
="http://www.w3.org/1999/XSL/Transform"
  xmlns:exsl
="http://exslt.org/common"
  xmlns:d
="http://docbook.org/ns/docbook"
  xmlns:fo
="http://www.w3.org/1999/XSL/Format"
  version
="1.0"
  exclude-result-prefixes
="exsl">
<!-- ********** stylesheet for single-spaced, double-sided, book-size (5.5 by 8.375) ********** -->

<xsl:stylesheet
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:exsl="http://exslt.org/common"
  xmlns:d="http://docbook.org/ns/docbook"
  xmlns:fo="http://www.w3.org/1999/XSL/Format"
  version="1.0"
  exclude-result-prefixes="exsl">

<!-- import the 1.73.2 release, namespace-unaware stylesheet  -->
<!-- <xsl:import href=""/Applications/Utilities/oxygen/8.2/oxygen/frameworks/docbook/5.0/docbook-xsl-1.73.2/fo/docbook.xsl"/> -->

<!-- import the house style -->
<xsl:import href="/Library/WebServer/Documents/_XML/_DocBook/customfoDB5letter.xsl"/>

<!-- now add in the customisations local to this project for a project style -->

<!-- ============================================================================================== -->
<!-- set line height to adjust line spacing, 1.2 is normal, greater needed for Cardo98s font  -->
<!-- book/article spacing -->
<xsl:param name="line-height" select="1.3" />
<!-- double spaced MS -->
<!-- <xsl:param name="line-height" select="2.4" /> -->
<!-- ============================================================================================== -->
<!-- select page orientation, select="'land'" or select="'USletter'" or select="'A4'"-->
<xsl:param name="paper.type" select="'USletter'" />
<!-- ============================================================================================== -->
<!-- select single- ("0") or double-sided ("1") output -->
<xsl:param name="double.sided" select="1" />
<!-- ============================================================================================== -->
<!-- hard cover 5.5 by 8.375 inches -->
<xsl:param name="page.height" select="'8.375in'" />
<xsl:param name="page.width" select="'5.5in'" />
<xsl:param name="page.height.portrait" select="'8.375in'" />
<xsl:param name="page.width.portrait" select="'5.5in'" />
<!-- define the layout of a page  -->
<xsl:param name="page.margin.inner" select="'0.75in'" />
<xsl:param name="page.margin.outer" select="'0.6875in'" />
<xsl:param name="page.margin.top" select="'0.4in'" />
<xsl:param name="page.margin.bottom" select="'0.4in'" />
<xsl:param name="body.margin.top" select="'0.45in'" />
<xsl:param name="body.margin.bottom" select="'0.55in'" />
<xsl:param name="region.before.extent" select="'0.25in'" />
<xsl:param name="region.after.extent" select="'0.25in'" />
<!--  -->

<!-- ============================================================================================== -->
<!-- activate XEP extensions -->
<xsl:param name="xep.extensions" select ="1" />

<!-- ============================================================================================== -->
<!-- activate FOP extensions -->
<!-- <xsl:param name="fop.extensions" select ="1" />
 -->

<!-- ============================================================================================== -->
<!-- set relative space in header for left, center and right cells  -->
<xsl:param name="header.column.widths" select="'1 10 1'" >
</xsl:param>

<!-- ============================================================================================== -->
<!-- rule below header  -->
<xsl:param name="header.rule" select="1" >
</xsl:param>

<!-- define the rule below the header -->
<xsl:template name="head.sep.rule">
 
<xsl:if test="$header.rule != 0">
   
<xsl:attribute name="border-bottom-width">0.5pt</xsl:attribute>
   
<xsl:attribute name="border-bottom-style">solid</xsl:attribute>
   
<xsl:attribute name="border-bottom-color">black</xsl:attribute>
 
</xsl:if>
</xsl:template>     <!-- END name="head.sep.rule"  -->

<!-- ============================================================================================== -->
<!-- set header content style  -->
<xsl:attribute-set name="header.content.properties">
 
<xsl:attribute name="font-family">Cardo</xsl:attribute>
 
<xsl:attribute name="font-size">11pt</xsl:attribute>
 
<xsl:attribute name="font-weight">bold</xsl:attribute>
</xsl:attribute-set>

<!-- ============================================================================================== -->
<!-- Customize the header content, book title centered on even, chapter title on odd pages  -->

<!--
  <xsl:template match="section/info/title">
    <fo:block xsl:use-attribute-sets="head1">
      <fo:marker marker-class-name="sect-head">
        <fo:block>
          <xsl:value-of select="."/>
        </fo:block>
      </fo:marker>
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>
 -->


<!--
<fo:static-content flow-name="xsl-region-head">
  <fo:block>
    <fo:retrieve-marker retrieve-class-name="sect-head"/>
  </fo:block>
</fo:static-content>
 -->


 
<xsl:template name="header.content">
 
<xsl:param name="pageclass" select="''"/>
 
<xsl:param name="sequence" select="''"/>
 
<xsl:param name="position" select="''"/>
 
<xsl:param name="gentext-key" select="''"/>

<!--        <xsl:variable name="sectname">
          <fo:retrieve-marker retrieve-class-name="." />
        </xsl:variable> -->

 
<xsl:variable name="candidate">
   
<!-- sequence can be odd, even, first, blank -->
   
<!-- position can be left, center, right -->
   
<xsl:choose>

     
<xsl:when test="$sequence = 'odd' and $position = 'left'">
     
</xsl:when>
     
<xsl:when test="$double.sided != 0 and $sequence = 'odd' and $position = 'center'">
       
<fo:retrieve-marker
          retrieve-class-name="section.head.marker"
          retrieve-position
="first-including-carryover"
          retrieve-boundary
="page-sequence"/>
<!--        <xsl:apply-templates select="." mode="titleabbrev.markup"/> -->
<!--      <xsl:value-of  select="ancestor-or-self::d:article/d:info/d:title"/> -->
     
</xsl:when>
     
<xsl:when test="$double.sided != 0 and $sequence = 'odd' and $position = 'right'">
     
</xsl:when>

     
<xsl:when test="$double.sided != 0 and $sequence = 'even' and $position = 'left'"> 
     
</xsl:when>
     
<xsl:when test="$double.sided != 0 and $sequence = 'even' and $position = 'center'">
       
<xsl:value-of  select="ancestor-or-self::d:article/d:info/d:title"/>
     
</xsl:when>
     
<xsl:when test="$double.sided != 0 and $sequence = 'even' and $position = 'right'">
     
</xsl:when>

     
<xsl:when test="$sequence = 'first' and $position = 'left'">
     
</xsl:when>
     
<xsl:when test="$sequence = 'first' and $position = 'right'"> 
     
</xsl:when>
     
<xsl:when test="$sequence = 'first' and $position = 'center'">
     
</xsl:when>

     
<xsl:when test="$sequence = 'blank' and $position = 'left'">
     
</xsl:when>
     
<xsl:when test="$double.sided != 0 and $sequence = 'blank' and $position = 'center'">
       
<xsl:text>This page intentionally left blank</xsl:text>
     
</xsl:when>
     
<xsl:when test="$sequence = 'blank' and $position = 'right'">
     
</xsl:when>



     
<xsl:when test="$double.sided = 0 and $sequence = 'blank'">
     
</xsl:when>

     
<xsl:when test="$double.sided = 0 and $position = 'left'">
     
</xsl:when>
     
<xsl:when test="$double.sided = 0 and $position = 'center'">
        <xsl:value-of  select="ancestor-or-self::d:article/d:info/d:title"/>
     
</xsl:when>
     
<xsl:when test="$double.sided = 0 and $position = 'right'">
     
</xsl:when>

   
</xsl:choose>
 
</xsl:variable>

   
<!-- Does runtime parameter turn off blank page headers? -->
   
<xsl:choose>
     
<xsl:when test="$sequence='blank' and $headers.on.blank.pages=0">
       
<!-- no output -->
     
</xsl:when>
   
<!-- titlepages have no headers -->
     
<xsl:when test="$pageclass = 'titlepage'"> 
       
<!-- no output -->
     
</xsl:when>
     
<xsl:otherwise>
       
<xsl:copy-of select="$candidate"/>
     
</xsl:otherwise>
   
</xsl:choose>

</xsl:template>     <!-- END name="header.content"  -->

<!-- ============================================================================================== -->
<!-- set relative space in footer for left, center and right cells  -->
<xsl:param name="footer.column.widths" select="'2 1 2'" >
</xsl:param>

<!-- ============================================================================================== -->
<!-- rule above footer  -->
<xsl:param name="footer.rule" select="1" >
</xsl:param>

<!-- define the rule above the footer -->
<xsl:template name="foot.sep.rule">
 
<xsl:if test="$footer.rule != 0">
   
<xsl:attribute name="border-top-width">0.5pt</xsl:attribute>
   
<xsl:attribute name="border-top-style">solid</xsl:attribute>
   
<xsl:attribute name="border-top-color">black</xsl:attribute>
 
</xsl:if>
</xsl:template>     <!-- END name="foot.sep.rule"  -->

<!-- ============================================================================================== -->
<!-- set footer content style  -->
<xsl:attribute-set name="footer.content.properties">
 
<xsl:attribute name="font-family">Cardo</xsl:attribute>
 
<xsl:attribute name="font-size">10pt</xsl:attribute>
 
<xsl:attribute name="font-weight">bold</xsl:attribute>
</xsl:attribute-set>

<!-- ============================================================================================== -->
<!-- customize the footer content -->
<xsl:template name="footer.content">
 
<xsl:param name="pageclass" select="''"/>
 
<xsl:param name="sequence" select="''"/>
 
<xsl:param name="position" select="''"/>
 
<xsl:param name="gentext-key" select="''"/>

<!--
  <fo:block>
    <xsl:value-of select="$pageclass"/>
    <xsl:text>, </xsl:text>
    <xsl:value-of select="$sequence"/>
    <xsl:text>, </xsl:text>
    <xsl:value-of select="$position"/>
    <xsl:text>, </xsl:text>
    <xsl:value-of select="$gentext-key"/>
  </fo:block>
-->


 
<fo:block>
   
<!-- pageclass can be front, body, back -->
   
<!-- sequence can be odd, even, first, blank -->
   
<!-- position can be left, center, right -->
   
<xsl:choose>
     
<xsl:when test="$pageclass = 'titlepage'">
       
<!-- nop; no footer on title pages -->
     
</xsl:when>

<!-- Double Sided Even -->
     
<xsl:when test="$double.sided != 0 and $sequence = 'even' and $position='left'">
       
<fo:page-number/>
     
</xsl:when>
     
<xsl:when test="$double.sided != 0 and $sequence = 'even' and $position='center'">
     
</xsl:when>
     
<xsl:when test="$double.sided != 0 and $sequence = 'even' and $position='right'">
       
<xsl:value-of  select="ancestor-or-self::d:article/d:info/d:authorgroup/d:author/d:personname/d:firstname"/>
       
<xsl:value-of select="'&#x00A0;'"/>
       
<xsl:value-of  select="ancestor-or-self::d:article/d:info/d:authorgroup/d:author/d:personname/d:surname"/>
     
</xsl:when>

<!-- Double Sided Odd or First -->
     
<xsl:when test="$double.sided != 0 and ($sequence = 'odd' or $sequence = 'first') and $position='left'">
       
<xsl:value-of  select="ancestor-or-self::d:article/d:info/d:authorgroup/d:author/d:personname/d:firstname"/>
       
<xsl:value-of select="'&#x00A0;'"/>
       
<xsl:value-of  select="ancestor-or-self::d:article/d:info/d:authorgroup/d:author/d:personname/d:surname"/>
     
</xsl:when>
     
<xsl:when test="$double.sided != 0 and ($sequence = 'odd' or $sequence = 'first') and $position='center'">
     
</xsl:when>
     
<xsl:when test="$double.sided != 0 and ($sequence = 'odd' or $sequence = 'first') and $position='right'">
        <fo:page-number/>
     
</xsl:when>

<!-- Double Sided Odd -->
<!--
      <xsl:when test="$double.sided != 0 and $sequence = 'odd' and $position='left'">
        <xsl:value-of  select="ancestor-or-self::d:article/d:info/d:authorgroup/d:author/d:personname/d:firstname"/>
            <xsl:value-of select="'&#x00A0;'"/>
        <xsl:value-of  select="ancestor-or-self::d:article/d:info/d:authorgroup/d:author/d:personname/d:surname"/>
      </xsl:when>
      <xsl:when test="$double.sided != 0 and $sequence = 'even' and $position='center'">
      </xsl:when>
      <xsl:when test="$double.sided != 0 and $sequence = 'even' and $position='right'">
        <fo:page-number/>
      </xsl:when>
-->


<!-- single Sided -->
     
<xsl:when test="$double.sided = 0">
       
<xsl:choose>
         
<xsl:when test="$position='left'">
           
<xsl:value-of  select="ancestor-or-self::d:article/d:info/d:authorgroup/d:author/d:personname/d:firstname"/>
           
<xsl:value-of select="'&#x00A0;'"/>
           
<xsl:value-of  select="ancestor-or-self::d:article/d:info/d:authorgroup/d:author/d:personname/d:surname"/>
         
</xsl:when>
         
<xsl:when test="$position='center'">
         
</xsl:when>
         
<xsl:when test="$position='right'">
           
<fo:page-number/>
         
</xsl:when>
         
<xsl:otherwise>
           
<!-- nop -->
         
</xsl:otherwise>
       
</xsl:choose>
     
</xsl:when>

<!-- Blank Pages -->
     
<xsl:when test="$sequence='blank'">
       
<xsl:choose>
<!-- Double Sided - No Footers -->
         
<xsl:when test="$double.sided != 0 and $position = 'left'">
         
</xsl:when>
         
<xsl:when test="$double.sided != 0 and $position = 'center'">
         
</xsl:when>
         
<xsl:when test="$double.sided != 0 and $position = 'right'">
         
</xsl:when>
<!-- Single Sided  - Footers as usual if this should occur -->
         
<xsl:when test="$double.sided = 0 and $position='left'">
           
<xsl:value-of  select="ancestor-or-self::d:article/d:info/d:authorgroup/d:author/d:personname/d:firstname"/>
           
<xsl:value-of select="'&#x00A0;'"/>
           
<xsl:value-of  select="ancestor-or-self::d:article/d:info/d:authorgroup/d:author/d:personname/d:surname"/>
         
</xsl:when>
         
<xsl:when test="$double.sided = 0 and $position='center'">
         
</xsl:when>
         
<xsl:when test="$double.sided = 0 and $position='right'">
           
<fo:page-number/>
         
</xsl:when>
         
<xsl:otherwise>
           
<!-- nop -->
         
</xsl:otherwise>
       
</xsl:choose>
     
</xsl:when>
     
<xsl:otherwise>
       
<!-- nop -->
     
</xsl:otherwise>
   
</xsl:choose>
 
</fo:block>
</xsl:template>     <!-- END name="footer.content"  -->



</xsl:stylesheet>

Ron Catterall wrote:
Dave
I this any use - standard 3 col header and footer customization.  Works OK for latest DB% snapshot (d: namespace)
Ron

Thanks Ron.



Just a case of picking out the right combination of states and your content in that 'candidate' variable?

e.g. <xsl:when test="$double.sided != 0 and $sequence = 'even' and position='right'">
With Content selected from document.

Bit messier^h more complex than the html isn't it :-)

Getting there, thanks for the example.

Your deleted marker stuff looks tempting though.

Much appreciated.

regards



--
Dave Pawson
XSLT, XSL-FO and Docbook FAQ
http://www.dpawson.co.uk


-- 
Ron Catterall, Phd, DSc                         email: ron@catterall.net
Prolongacion de Hidalgo 140                             http://catterall.net/
San Felipe del Agua                                        tel: +52 951 520 1821
Oaxaca      68020  Mexico                          fax: +1 530 348 8309


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]