Re: [xsl] Seperating Heading from Content

Subject: Re: [xsl] Seperating Heading from Content
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 07 Nov 2011 13:28:43 -0500
At 2011-11-07 19:17 +0100, Struijk, Toon van der wrote:
What I try to achieve is the following:

In a very standard PDF publication I want the 'body' content always appear at the same height on every page. But part of this content is a H2 heading (yes, I'm in the process of transforming xHTML data to a nicely styled PDF).
I have set up all pages according to the client's specs (the 'fo:layout-master-set'), and now I'm defining the individual page sets, including the one where the 'body' goes into (<fo:flow flow-name="xsl-region-body">). And there it doesn't go the way I want it.
Because the 'H2' is part of the body, I don't know of a way how to 'seperate' this from the rest of the content.
I want the 'H2' (whenever it is available) always appear at the top of the page with a distance of 45mm from the top. The rest of the body I want to appear at 65mm from the top, always no matter if it is preceeded with a 'H2' or not.

To be more specific:
When in the body a 'H2' is encountered, I put it on new page ('page-break-before="always"' in the '<xsl:template match="h2">' definition) 45mm from the top, and after that the rest of the body (content) appears 20 mm (65mm from the top) after the 'H2'. But that content spans more then one page. And I want that content (without any 'H2') on the other pages to appear at the same height as on the page where it started after the 'H2'; 65mm from the top. To be more visual; every 'H2' must be positioned above the rest of the flowing body content.
How can I accomplish that?

By not putting your H2 content into the body, but rather into a static region you reserve above the body.

You establish the geometry of that region above your body region, and you populate it using <fo:static-content> rather than <fo:flow>.

You can do this with a single page sequence and use markers: the static content retrieves a dynamically-defined marker, and whenever you encounter an H2 you define the marker to be the H2's value. In order to suppress the marker from subsequent pages of content of the same H2, you immediately define the marker to be empty after defining the marker to have content. The retrieval will take the first one (with the content) on the first page, and the second one (empty) on subsequent pages.

I hope this helps.

. . . . . . . . . . Ken

-- Contact us for world-wide XML consulting and instructor-led training Free 5-hour video lecture: XSLT/XPath 1.0 & 2.0 Crane Softwrights Ltd. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: Legal business disclaimers:

Current Thread