I'm having trouble with XSL-FO and XML. I am actually quite new to this area. But I already love it as far as I can understand.
My problem is this, and I've tried everything so far: I want the current Bible book name to appear in the header of every page until a new one starts.
I have the XSL and XML code here: https://xsltfiddle.liberty-development.net/nb9PtDi/17
Are there possibilities? What do I have to change in the code?
Look at fo:marker
and fo:retrieve-marker
(see https://www.w3.org/TR/xsl11/#fo_marker).
A copy of the book name would go in the fo:marker
at the start of the first FO for the book, and the fo:static-content
for the header would include an fo:retrieve-marker
with a retrieve-class-name
that matches the marker-class-name
of the fo:marker
that you added.
A search for questions about fo:marker
will get you some examples of what to do.
I have fiddled with it at https://xsltfiddle.liberty-development.net/nb9PtDi/21
I added an fo:marker
in the template for CAPTION
(some properties omitted for clarity):
<xsl:template match="CAPTION">
<fo:block page-break-before="always">
<fo:marker marker-class-name="caption">
<xsl:apply-templates />
</fo:marker>
<xsl:value-of select="."/>
</fo:block>
</xsl:template>
and replaced the "HEADER" text with an fo:retrieve-marker
(some properties omitted for clarity):
<fo:static-content flow-name="kopf">
<fo:block>
<fo:retrieve-marker retrieve-class-name="caption" />
</fo:block>
</fo:static-content>
The connection between the two is the marker class name of "caption".
You don't seem to need them, but you can set the retrieve-position
and retrieve-boundary
properties on fo:retrieve-marker
to control what happens when, for example, there's two fo:marker
on the same page.