Re: [xsl] XSL-FO Question - fo:retrieve-marker

Subject: Re: [xsl] XSL-FO Question - fo:retrieve-marker
From: Jeff Sese <jsese@xxxxxxxxxxxx>
Date: Wed, 07 Feb 2007 14:40:47 +0800
Thanks for the tip, i tried it but it still doen't give me my desired output.

I change your sample code a bit, i placed the bottom marker inside a fo:block element to make it valid.

here's a sample fo i'm testing.

<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>
<fo:layout-master-set>
<fo:simple-page-master master-name="simple" page-height="11.69in" page-width="8.27in" margin-left="1in" margin-right="1in">
<fo:region-body margin-top="1in" margin-bottom="1in"/>
<fo:region-before extent="1in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simple">
<fo:static-content flow-name="xsl-region-before">
<fo:block border-bottom-style="solid" border-bottom-width="1pt" background-color="gray">
<fo:retrieve-marker retrieve-class-name="heading-start" retrieve-boundary="page-sequence" retrieve-position="first-including-carryover"/>
<fo:retrieve-marker retrieve-class-name="heading-end" retrieve-boundary="page-sequence" retrieve-position="last-starting-within-page"/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block>
<fo:block>
<fo:marker marker-class-name="heading-start">first heading</fo:marker>
<fo:marker marker-class-name="heading-end"></fo:marker>
</fo:block>
<fo:block text-align="center" font-size="14pt">First Heading</fo:block>
<fo:block>Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block break-after="page">Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block>
<fo:marker marker-class-name="heading-end">- first heading</fo:marker>
</fo:block>
</fo:block>
<fo:block>
<fo:block>
<fo:marker marker-class-name="heading-start">second heading</fo:marker>
<fo:marker marker-class-name="heading-end"></fo:marker>
</fo:block>
<fo:block text-align="center" font-size="14pt">Second Heading</fo:block>
<fo:block>Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block break-after="page">Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block>
<fo:marker marker-class-name="heading-end">- second heading</fo:marker>
</fo:block>
</fo:block>
<fo:block>
<fo:block>
<fo:marker marker-class-name="heading-start">third heading</fo:marker>
<fo:marker marker-class-name="heading-end"></fo:marker>
</fo:block>
<fo:block text-align="center" font-size="14pt">Third Heading</fo:block>
<fo:block>Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block break-after="page">Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block break-after="page">Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block>
<fo:marker marker-class-name="heading-end">- third heading</fo:marker>
</fo:block>
</fo:block>
<fo:block>
<fo:block>
<fo:marker marker-class-name="heading-start">fourth heading</fo:marker>
<fo:marker marker-class-name="heading-end"></fo:marker>
</fo:block>
<fo:block text-align="center" font-size="14pt">Fourth Heading</fo:block>
<fo:block>Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block>Some text</fo:block>
<fo:block>
<fo:marker marker-class-name="heading-end">- fourth heading</fo:marker>
</fo:block>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>


a the headers i got where:
page 1: first heading
page 2: second heading
page 3: third heading
page 4: third heading
page 5: fourth heading - fourth heading

but what i need is:
page 1: first heading
page 2: first heading - second heading
page 3: second heading - third heading
page 4: third heading
page 5: third heading - fourth heading

I tried playing with the placement of the markers and the still can't get the right result. Anymore suggestions?

*Jeff Sese*

J.Pietschmann wrote:
Jeff Sese wrote:
then i need to have headers like these:
page 1: title 1 - title 2
page 2: title 2 - title 3
page 3: title 3
page 4: title 3 - title 4

but so far what i get is this:

page 1: title 1 - title 2
page 2: title 2 - title 3
page 3: title 3 - title 3
page 4: title 3 - title 4

You can try to define an empty heading-end marker after the heading start, and the real heading-end right before the next heading start. Be careful to have a proper heading end at the end of the document.

 <xsl:template match="article">
    <fo:block>
       <fo:marker marker-class-name="heading-start"><xsl:value-of
 select="head"/></fo:marker>
       <fo:marker marker-class-name="heading-end" />
       <xsl:apply-templates/>
       <fo:marker marker-class-name="heading-end"><xsl:value-of
 select="concat(' - ', head)"/></fo:marker>
    </fo:block>
 </xsl:template>

Beware: untested.

J.Pietschmann

Current Thread