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

Subject: [xsl] XSL-FO Question - fo:retrieve-marker
From: Jeff Sese <jsese@xxxxxxxxxxxx>
Date: Tue, 06 Feb 2007 16:18:00 +0800
Hi,

I know that fo:retrieve-marker does not return any value during xsl transformation and it is only a formatting instruction for the formatting engine to interpret, but i'm having problems generating dynamic running heads that are like dictionary styled.

I have a running head that list the first article title that appeared in the page and the last article that appeared in the page. And if i have pages like these:

+--------------+  +--------------+  +--------------+  +--------------+
+title 1         +  +some text   +  +some text   +  +some text   +
+some text   +  +some text   +  +some text   +  +some text   +
+some text   +  +title 3         +  +some text   +  +title 4         +
+some text   +  +some text   +  +some text   +  +some text   +
+title 2         +  +some text   +  +some text   +  +some text   +
+some text   +  +some text   +  +some text   +  +some text   +
+some text   +  +some text   +  +some text   +  +some text   +
+some text   +  +some text   +  +some text   +  +some text   +
+---page 1---+  +---page 2---+  +---page 3---+  +---page 4---+

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

my sample xml looks like this:

<root>
   <article>
      <head>title 1</title>
      <p>some text</p>
      ...
   </article>
   ...
</root>

my xsl looks like this:

<xsl:template match="/">
<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" padding-top="0.5in"/>
</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">
<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">
<xsl:apply-templates select="root/article"/>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>


<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:value-of select="concat(' - ', head)"/></fo:marker>
<xsl:apply-templates/>
</fo:block>
</xsl:template>


I need to know when a retrieve-markers are equal or from the same article, is this possible? if not is there a work around for this?

Thanks,
--
*Jeff Sese*

Current Thread