David described a method of using an absolutely positioned block-container, but it can be done with side regions too. That's the method the FO designers intended, but it is harder to get working in the DocBook XSL stylesheets.

The side areas are FO regions similar to the top and bottom regions used for headers/footers. But the DocBook page-masters don't specify anything for the side regions, so there is no template to fill in with content as with header.content and footer.content.

But you can create your own custom page-masters that add the side regions (labelled "start" and "end" in FO parlance), and then you can do other customizations to fill them with content. I can see how setting this up with empty placeholder templates would make an excellent feature request for future stylesheet releases.

In the mean time, you can create a set of simple-page-master elements that include region-start and region-end areas. For example:

   <fo:simple-page-master master-name="custom-body-odd"
                          page-width="{$page.width}"
                          page-height="{$page.height}"
                          margin-top="{$page.margin.top}"
                          margin-bottom="{$page.margin.bottom}"
                          margin-left="{$margin.left.inner}"
                          margin-right="0pt">
     <fo:region-body margin-bottom="{$body.margin.bottom}"
                     margin-top="{$body.margin.top}"
                     margin-right="{$page.margin.outer}"
                     column-gap="{$column.gap.body}"
                     column-count="{$column.count.body}">
     </fo:region-body>
     <fo:region-before region-name="xsl-region-before-odd"
                       extent="{$region.before.extent}"
                       precedence="true"
                       display-align="before"/>
     <fo:region-after region-name="xsl-region-after-odd"
                      extent="{$region.after.extent}"
                      precedence="true"
                      display-align="after"/>
     <fo:region-start region-name="xsl-region-start-odd"
                      extent="0pt"/>
     <fo:region-end region-name="xsl-region-end-odd"
                      extent="{$region.side.extent}"/>
   </fo:simple-page-master>

This one is for odd body pages, so you would need to do this for as many different simple-page-masters are you need.

Note the addition of fo:region-start with zero extent for an odd page (the inside), and an fo:region-end with an extent value that is set with a parameter (the outside). You create a set of such simple-page-masters, a custom fo:page-sequence-master that uses those simple-page-masters, and customize the template named "select.user.pagemaster" to call your custom page masters, all described here:

http://www.sagehill.net/docbookxsl/PageDesign.html

To fill the regions with content, you can customize the template named "running.head.mode" from fo/pagesetup.xsl, which sets up the fo:static-content for the region-before (top). You want to add fo:static-content elements to also set up the region-start and region-end static content. Add something like:

 <fo:static-content flow-name="xsl-region-end-odd">
   <fo:block xsl:use-attribute-sets="side.content.properties">
     <xsl:call-template name="side.margin.content">
       <xsl:with-param name="pageclass" select="$pageclass"/>
       <xsl:with-param name="sequence" select="'odd'"/>
       <xsl:with-param name="gentext-key" select="$gentext-key"/>
     </xsl:call-template>
   </fo:block>
 </fo:static-content>

Note that the flow-name attribute here matches the region-name value in the simple-page-master. That's how you can match up different content in different locations.

In this example I specified a new attribute-set named "side.content.properties", and a new template named "side.margin.content" that you would need to write to fill in the content of the side area.

If this sketch isn't sufficient, ask for more details. When it is working, your FO file should contain your custom fo:simple-page-masters, your custom fo:page-sequence-masters, one or more fo:page-sequences whose master-reference attribute calls one of the custom page-sequence-masters, and the fo:page-sequences should also contain your custom fo:static-content elements for the side content. There are a lot of details to take care of, but it does work when it is all in place.

Bob Stayton
Sagehill Enterprises
[email protected]


----- Original Message ----- From: "honyk" <[email protected]>
To: <[email protected]>
Sent: Friday, January 23, 2009 3:25 PM
Subject: [docbook-apps] Stamp in outer margin


Hello Everyone,

I'd like to add stamp (picture) to the outer margin of PDF file, but I've
found it is probably impossible as there are only specified
header/body/footer areas on all default templates. It is intended as static
content. I've tried to modify header template (to add the block container
with absolute position to ensure its position in proper place), but while
left attribute is preserved, top attribute is ignored in XEP. I don't know
exactly if such block out of defined static area is legal or it is not
supported in XEP. If there are any more straightforward solutions, please
let me know.

Jan


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]





---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to