RE: [docbook-apps] icon for chapter number on the edge of page

2008-10-23 Thread Mauritz Jeanson
 -Original Message-
 From: Lily Galle 
 
 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.


In the message you sent to docbook-apps on 15 October, you explain how you
have failed in using floating sidebars to display a chapter number icon in
the margin (at the outside edge). 

It is possible that a solution involving floats could work. In fact, it's
the only mechanism available for placing content on the outside of left
and right pages. However, it seems a bit awkward to use sidebar in the
source document in order to output the floats; it would be more appropriate
to let a customized stylesheet handle that.

But first you need to make sure that your FO processor supports floats. I
presume that you use FOP (from the message you sent on 1 October), which
means that you are out of luck. FOP does not support floats. See
http://xmlgraphics.apache.org/fop/compliance.html#fo-object-float.

So if you can, try another FO processor. XEP is a good choice. 

Mauritz



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [docbook-apps] icon for chapter number on the edge of page

2008-10-23 Thread Bob Stayton

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-nameblank-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
[EMAIL PROTECTED]


- Original Message - 
From: Lily Galle [EMAIL PROTECTED]

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