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] icon for chapter number on the edge of page


Hi Lily,
I implemented bleed tabs that operate in a similar fashion using the side 
regions in an FO page-master.  There are a lot of details to make it work, 
but it can be done.  The advantage of using side regions is that the content 
is static and doesn't need an anchor in the body flow on each page to work. 
The side regions are named "start" for the left side in left-to-write 
writing mode, and "end" for the right side in that mode.  Here is an outline 
of the solution:

1.  Create custom page masters that add fo:region-start and fo:region-end 
elements to each fo:simple-page-master:

    <fo:simple-page-master master-name="blank-odd"
                           page-width="{$page.width}"
                           page-height="{$page.height}"
                           margin-top="{$page.margin.top}"
                           margin-bottom="{$page.margin.bottom}"
                           margin-left="0pt"
                           margin-right="{$page.margin.inner}">
      <fo:region-body display-align="center"
                      margin-left="{$margin.left.outer}"
                      margin-bottom="{$body.margin.bottom}"
                      margin-top="{$body.margin.top}">
        <xsl:if test="$fop.extensions = 0">
          <xsl:attribute name="region-name">blank-body</xsl:attribute>
        </xsl:if>
      </fo:region-body>
      <fo:region-before region-name="xsl-region-before-blank-odd"
                        extent="{$region.before.extent}"
                        display-align="before"/>
      <fo:region-after region-name="xsl-region-after-blank-odd"
                       extent="{$region.after.extent}"
                       display-align="after"/>
      <fo:region-start region-name="xsl-region-start-blank-odd"
                       extent="{$region.side.extent}"/>
      <fo:region-end region-name="xsl-region-end-blank-odd"
                       extent="0pt"/>
    </fo:simple-page-master>

2.  Customize the user.pagemasters template to call your new page masters.


3.  Customize the template named running.head.mode from fo/pagesetup.xsl to 
create several new fo:static-content elements. Use these for the "start" 
side:

  <fo:static-content flow-name="xsl-region-start-first">
    <xsl:call-template name="bleed.tab">
      <xsl:with-param name="pageclass" select="$pageclass"/>
      <xsl:with-param name="sequence" select="'first'"/>
      <xsl:with-param name="side" select="'start'"/>
      <xsl:with-param name="gentext-key" select="$gentext-key"/>
    </xsl:call-template>
  </fo:static-content>

  <fo:static-content flow-name="xsl-region-start-odd">
    <xsl:call-template name="bleed.tab">
      <xsl:with-param name="pageclass" select="$pageclass"/>
      <xsl:with-param name="sequence" select="'odd'"/>
      <xsl:with-param name="side" select="'start'"/>
      <xsl:with-param name="gentext-key" select="$gentext-key"/>
    </xsl:call-template>
  </fo:static-content>

  <fo:static-content flow-name="xsl-region-start-even">
    <xsl:call-template name="bleed.tab">
      <xsl:with-param name="pageclass" select="$pageclass"/>
      <xsl:with-param name="sequence" select="'even'"/>
      <xsl:with-param name="side" select="'start'"/>
      <xsl:with-param name="gentext-key" select="$gentext-key"/>
    </xsl:call-template>
  </fo:static-content>

4.  Create another set replacing "start" with "end" everywhere.  These 
static-content elements put content into the side regions.

5.  Create a template named "bleed.tab" that accepts those params and uses 
an xsl:choose to compute the content for each combination of pageclass, 
sequence, side, and gentext-key (maybe only when it is "chapter").   Many 
combinations won't have content, so only create xsl:when elements for those 
combinations that do (sequence="odd" and side="end" for example).  The 
context for the call to this template is the element that creates a 
page-sequence, so the context is chapter when doing a chapter element.  You 
can count preceding chapter elements to compute a position in the side 
margin for each chapter so they march down the page.

6.  The static content for each combination is an fo:block-container with 
absolute positioning:

      <fo:block-container
                    absolute-position="absolute"
                    width="0.5in"
                    height="0.5in"
                    top="1.15in">  <!-- === compute this value -->
        <fo:block>
          <fo:external-graphic ...

You'll have to experiment with sizes and positioning to get it to work.

I didn't try this with FOP, so I hope it works for you.


Bob Stayton
Sagehill Enterprises
bobs@sagehill.net


----- Original Message ----- 
From: "Lily Galle" <lily.galle@gmx.net>
To: <docbook-apps@lists.oasis-open.org>
Sent: Thursday, October 23, 2008 1:49 AM
Subject: [docbook-apps] icon for chapter number on the edge of page


> Hi,
>
> My docBook ist double-sided. I would like to set one small icon on the 
> outside of each page.   In the icon is the chapter number. In the CHAPTER 
> ONE there is “1” in the icon. In the CHAPTER TWO, there is “2” in the 
> icon.
>
> This icon should be POSITIONED differently. In the CHAPTER ONE it has a 
> distance of “3in” to the top of the page. In the CHAPTER TWO it has a 
> distance of “4in” to the top of the page.
>
> Could someone tell me how to manage it? Thanks.
>
> Lily
>
> -- 
> Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: 
> http://www.gmx.net/de/go/multimessenger
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>
>
> 



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