Hi Claudio,
This should get you started, with some comments:

<!-- Shift some of the page side margin to the body side margin to make room -->
<xsl:param name="page.margin.outer">.5in</xsl:param>
<xsl:param name="body.margin.outer">.25in</xsl:param>
<xsl:param name="region.outer.extent">12pt</xsl:param>
<!-- extend the side region over the header/footer regions -->
<xsl:param name="side.region.precedence">true</xsl:param>

<xsl:attribute-set name="region.outer.properties">
  <!-- By default, the side region reference-orientation is 90 so text is 
rotated to fit,
     so this sets it back to zero for upright numbers -->
  <xsl:attribute name="reference-orientation">0</xsl:attribute>
 <!-- But I don't think FOP supports "outside" yet -->
  <xsl:attribute name="text-align">outside</xsl:attribute>
  <xsl:attribute name="width">0.25in</xsl:attribute>
</xsl:attribute-set>

<xsl:attribute-set name="outer.region.content.properties">
  <!-- Put any text formatting attributes here --></xsl:attribute-set>

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

  <!-- pageclass can be front, body, back -->
  <!-- sequence can be odd, even, first, blank -->
  <!-- position can be left, center, right -->

  <!-- Play with these settings to get them right.  I added the border just for 
visualization of the location -->
  <fo:block-container border="0.1pt solid blue" 
         height="3in" display-align="after" text-align="outside" width=".25in">
    <fo:block xsl:use-attribute-sets="outer.region.content.properties">
      <!-- this bit compensates for FOP's lack of text-align="outside" -->
       <xsl:attribute name="text-align">
        <xsl:choose>
          <xsl:when test="$sequence='odd' or $sequence='first'">end</xsl:when>
          <xsl:otherwise>start</xsl:otherwise>
        </xsl:choose>
      </xsl:attribute>
    <!-- and here is where the page number is specified -->
      <fo:page-number/>
    </fo:block>
  </fo:block-container>
</xsl:template>

Let me know if you have any questions.

Bob Stayton
Sagehill Enterprises
[email protected]


From: Claudio Tubertini 
Sent: Sunday, May 12, 2013 3:52 AM
To: [email protected] 
Subject: [docbook-apps] Page numbers in body.margin.outer


I would like to put the page number (in chapters or articles) in the 
body.margin.outer (I believe this is the correct parameter, but I'm not sure), 
in the middle of the page, instead of usual place in footer or header. Can 
someone suggest me where to look for? I'm using FOP processor with Oxygen. 
Regards
Claudio Tubertini

Reply via email to