[xep-support] Using markers for headers

Dovid Zalkin dovid at tech-tav.com
Wed Sep 20 03:49:33 PDT 2006


Hi Alexei,
    Thanks. However, there is one point I neglected to mention: the position of the chapter or section on the header has to alternate between right and left depending if the page is recto or verso; whereas this solution uses absolute positioning of the title in the header. Is there any way to accomodate this requirement as well? I was thinking of something along the lines of defining double sets of the markers, one set on the left side of the page and the other on the right side, and somehow (possibly using the page-sequence-master) controlling which will be visible based on if the page is even or odd? Is this possible?
Thank you again,
David

  ----- Original Message ----- 
  From: Alexei Gagarinov 
  To: xep-support at renderx.com 
  Sent: Tuesday, September 19, 2006 5:50 PM
  Subject: Re: [xep-support] Using markers for headers


  Hi David,

  There is a tricky way to achieve the described behaviour.
  It consists of 2 steps:
  1) You need 2 marker class: one for *the content* of subsections and another class for *titles* of chapters, sections, and subsections

  <fo:flow>
     ...
    <!-- chapter title --> 
    <fo:block>
      <fo:marker marker-class-name="titles">
        <fo:block-container position="absolute" 
                top="0.5in" left="1in" width="2in" height="0.5in" 
                background-color="white">
          <fo:block>Chapter x</fo:block>
        </fo:block-container>
      </fo:marker>
      Chapter Title
    </fo:block>
    <!-- section title --> 
    <fo:block>
      <fo:marker marker-class-name="titles">
        <fo:block-container position="absolute" 
                top="0.5in" left="1in" width="2in" height="0.5in" 
                background-color="white">
          <fo:block>Section x</fo:block>
        </fo:block-container>
      </fo:marker>
      Section Title
    </fo:block>
      <fo:block>chapter and section text goes here...</fo:block>
      <!-- subsection title -->
      <fo:block>
        <fo:marker marker-class-name="titles">
          <fo:block-container position="absolute" 
                  top="0.5in" left="1in" width="2in" height="0.5in" 
                  background-color="white">
            <fo:block>Subsection 1</fo:block>
          </fo:block-container>
        </fo:marker>
        The First Subsection Title
      </fo:block>
      <fo:block>
        <fo:marker marker-class="subsection">
          <fo:block-container position="absolute" 
                  top="0.5in" left="1in" width="2in" height="0.5in" 
                  background-color="white">
            <fo:block>Subsection 1</fo:block>
          </fo:block-container>
        </fo:marker>
        subsection text goes here...
      </fo:block>
      ...
      <!-- subsection title -->
      <!-- subsection title -->
      <fo:block>
        <fo:marker marker-class-name="titles">
          <fo:block-container position="absolute" 
                  top="0.5in" left="1in" width="2in" height="0.5in" 
                  background-color="white">
            <fo:block>Subsection 2</fo:block>
          </fo:block-container>
        </fo:marker>
        The Second Subsection Title
      </fo:block>
      <fo:block>
        <fo:marker marker-class="content">
          <fo:block-container position="absolute" 
                  top="0.5in" left="1in" width="2in" height="0.5in" 
                  background-color="white">
            <fo:block>Subsection 2</fo:block>
          </fo:block-container>
        </fo:marker>
        subsection text goes here...
      </fo:block>
  </fo:flow>

  Note that *all* markers are absolute block containers with *the same* position. Step 2 explains this.

  2) Define retrieve markers as described in 'XSL FAQ' by Dave Pawson:

    <fo:static-content flow-name="xsl-region-before">
        <fo:retrieve-marker retrieve-class-name="content" 
                  retrieve-position="first-including-carryover" 
                  retrieve-boundary="page"/>
        <fo:retrieve-marker retrieve-class-name="titles" 
               retrieve-position="first-starting-within-page" <!-- default; can be omitted -->
               retrieve-boundary="page"/>
    </fo:static-content>

  If there is no titles on a page, it will select the first retrieve marker - the "previous" subsection (i.e subsection whose content on the current page); the second retrieve-marker have no areas to be retrieved.
  If there is title - i.e. chapter or section or subsection change - break on a page, the second retrieve will override the first marker (that's why we need to use absolute block containers with the same position).

  I hope this helps,

  Best regards,
    Alexei Gagarinov
  RenderX

    ----- Original Message ----- 
    From: Dovid Zalkin 
    To: xep-support at renderx.com 
    Sent: Monday, September 18, 2006 5:39 PM
    Subject: [xep-support] Using markers for headers


    Hi. I am creating a PDF document, in which the header of each page should be the name of the chapter, or section (of a chapter), or subsection which starts on that page. For example, if section 2.3 starts on page 17, then the header on page 17 should contain the name of section 2.3. Deeper sections are not displayed on the header. The problem is if there is no subsection starting on a particular page: the desired behavior in such a case would be for the name of the previous subsection to be displayed; however, what is actually displayed is the name of the chapter. The problem seems to be that if there is no marker which starts on the page then the marker reverts to the first marker in the page-sequence. This seems to be the proper behavior according to XSL-FO. What I want to know is if there is any way around this? Even though on each page I want the first marker defined on the page, when there is no marker defined on the page I want to use the last marker previously defined.
    Thank you,

    David Zalkin
    Technology Consultant
    Tech-Tav Documentation Ltd.
    +972 (0)57 313 8506
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.renderx.com/pipermail/xep-support/attachments/20060920/6cb89c72/attachment.html>


More information about the Xep-support mailing list