Re: [xep-support] Using markers for headers

From: Alexei Gagarinov <agagarinov@renderx.com>
Date: Tue Sep 19 2006 - 08:50:41 PDT

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@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

-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo@renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/terms-of-service.html
Received on Tue Sep 19 09:03:12 2006

This archive was generated by hypermail 2.1.8 : Tue Sep 19 2006 - 09:03:16 PDT