Forum How do I...?

Running headings

s5b
I have a requirement with a document where I am wishing to produce running headings within the page flow. What I mean by running headings is that the document is split into sections, each section has a heading, and I want to repeat the heading (with the word "continued" appended) on the top of following pages when the section overflows the current page.

Now, I've looked at the demonstration pages and I've even tried some experiments myself.

There is a demonstration linked on the Prince site which shows flags of the world with various statistics about the associated country. The associated information often overflows from page to page (for example page 2 to page 3). The pages have running headings describing the countries shown on the current page. However, if an entry partially overflows from a previous page then the running heading does not show the name of the partial information at the beginning of the next page as the first country on that next page, but instead shows the first heading that appears on the next page. This is not what I want. I want the running heading to include the most recent content heading from the previous page when the entry overflows onto the next page.

From my own experimentation: I created a document with a number of lengthy sections, and each section has a heading. After each heading I inserted "header" markup into the content. When the content overflows I want the header area on the next page to include the most recent "header" for the new page, rather than the "header" associated with any content that happens to appear on this next page. However, what I see is the header area contains the correct information so long as the "header" is not redefined on the next page. If the "header" is redefined on the next page, then I see the redefined "header" on the top of the next page.

From the behaviour I have observed, I conclude that the order of the page processing is to render the page "body" content first, and then render the most recently defined "header" and "footer" content. This means that if, say, a new "header" gets defined somewhere within the page then this new "header" will be the content for the header area for the current page.

What I want is for the rendering to operate in the order of top to bottom areas. Thus, the "header" gets rendered (using any currently defined "header" - which may be from the previous page), followed by the body (which may redefine new "header" and "footer" areas), and finally render the footer.

I realise that my preferred processing order may have ramifications for the header area on the very first page, but I suspect that this may be overcome by defining the first page "header" as the very first piece of content in the document before any body content.

Any suggestions? Or is the some other way I can get this type of behaviour?

Thanks for any help you can provide.

Cheers, S t u a r t .
mikeday
If you are using named strings, you can append "start" to indicate that you wish to use the value the string holds at the start of the page, before any content on the current page has been processed. For example:
@page {
    @top {
        content: string(header, start)
    }
}

This means that the header set on the previous page will be used for this page, and if this page defines a new header half way through then it will be used on the following page. You can also specify "first" or "last", to use the first or last specified header on the current page. The default is "first".
jim_albright
I learned something new here too that I can use today. Wow. CSS really rocks.

Jim Albright
Wycliffe Bible Translators