Zen Report page number variable
I have a report that requires a different header block for the first page and another for subsequent pages.
Is there a way to direct a header page to another header page based on what the current page number is?
Comments
Perhaps pagemaster and masterreference elements can help you here. There you can define different templates for the pages depending if the page is first or last
There are two ways to use <pagemaster> and <masterreference> - (1) such that it encompasses your entire report or (2) the page details get reset for each entry in a group.
1. Have page 1 have one header/footer, and the rest of the report a different one
<pagemaster >
<masterreference masterReference="first" pagePosition="first">
<document define document details> add styles</document>
<pageheader> define pageheader </pageheader>
<pagefooter> define pagefooter</pagefooter>
</masterreference>
<document define document details> add styles</document>
<pageheader> define pageheader </pageheader>
<pagefooter> define pagefooter</pagefooter>
</masterreference></pagemaster><body report body here>
2. For each group in my xml have a specific first page, and then the rest all be something else
In my XML definition I have a group Sales and inside that group I have another group called SalesRep - the SalesReps are uniquely identified via an attribute I have defined as name
<pagemaster >
<masterreference masterReference="first" pagePosition="first">
<document define document details> add styles</document>
<pageheader> define pageheader </pageheader>
<pagefooter> define pagefooter</pagefooter>
</masterreference>
<document define document details> add styles</document>
<pageheader> define pageheader </pageheader>
<pagefooter> define pagefooter</pagefooter>
</masterreference>
</pagemaster>
<body genLastPageIdOn="@name">
Report details here
</group>
</body>
</section>
Hope this helps.
Thanks Julie.
I was hoping to use some type of page variable to drive what type of header to use but if that variable is not accessible I will have to use some other logic within the Zen template.
Thanks Julie.
I was hoping to use some type of page variable to drive what type of header to use but if that variable is not accessible I will have to use some other logic within the Zen template.
The page number used is <fo:page-number/> which wouldn't be available in xslt so you wouldn't be able to do any xsl:when or xsl:if statements related to it. You could define multiple <section> and give each section its own header