Reputation: 45
I have to generate a header that is dynamic and not static ,the value of which comes out from the xml file.I am using XSl:FO for generating pDF using XML.I want to add a section References to come in all the pages.
XSl File:
`<xsl:template match="References">
<fo:block-container height="12cm" width="5cm" top="15mm" left="12cm" position="absolute">
<fo:block font-size="8pt" font-family="Verdana">
<xsl:apply-templates/>
</fo:block>
</fo:block-
'
XML File:
<Referentces>
<lbl>Date</lbl>
<div>$date</div>
<lbl>From</lbl>
<div>$brief.owner</div>
<div>T $brief.tel</div>
#if($brief.fax)
<div>F $brief.fax</div>
#end
</Referenties>
How can i call this block to appear in all the pages automatically?
Upvotes: 0
Views: 1435
Reputation: 8877
In XSL FO, you do not place a block-container absolute positioned to attempt to make repeating headers. It will only be placed on the page in which it occurs and not all pages.
You use static-content for xsl-region-before. So your page-sequence should look something like this:
<fo:page-sequence master-reference="page">
<fo:static-content flow-name="xsl-region-before">
<fo:block>This is content on every page</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region--body">
<!-- body content here -->
</fo:flow>
</fo:page-sequence>
You can define the size of the header and body regions in the layout-master-set for the page-master in question.
Now, if you have dynamic content in that header that depends on the section/page you are in, then you use fo:marker and fo:retrieve-marker to pull that content from the page you are in into the header.
See http://www.renderx.com/tutorial.html#Markers for a tutorial on Markers and how you use them to pull information into the static regions.
Upvotes: 2