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
I this any use - standard 3 col header and footer customization.  Works OK for latest DB% snapshot (d: namespace)
Ron

<?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">
<!-- import the latest snapshot name space aware stylesheet  -->
<xsl:import href="/Applications/Utilities/oxygen/8.2/oxygen/frameworks/docbook/5.0/docbook-xsl-ns-snapshot/fo/docbook.xsl"/>

<!-- other stuff -->

<!-- ============================================================================================== -->
<!-- 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"  -->

<!-- other stuff -->

</stylesheet>

I'm looking for an example of a header & footer specification
for the customization layer, fo output.

I'm using the v5 docbook, snapshot stylesheets.

There seems to be no full example in the docs?
Just the attribute sets that seem to be building a table?



TIA


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


---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org


-- 
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]