tsharma14 0 Newbie Poster

Hi,
I am creating a word document using XSLT and FOP. I require different header and footer in first page and rest of pages. I tried different codes available on net but its not working.

So please give ur responses where I am doing mistake. I am sending you my code...

<!-- defines the layout master -->
<fo:layout-master-set>
<!-- defines the layout of First page -->
<fo:simple-page-master master-name="firstPage" page-height="29.7cm" page-width="21cm"
margin-top="1cm" margin-bottom="1cm" margin-left="1cm" margin-right="1cm">
<fo:region-body />
<fo:region-after region-name="footer-first" extent="0.5cm"/>
</fo:simple-page-master>

<fo:simple-page-master master-name="otherPage" page-height="29.7cm" page-width="21cm"
margin-top="1cm" margin-bottom="1cm" margin-left="1cm" margin-right="1cm">
<fo:region-body />
<fo:region-after region-name="header-rest" extent="1cm"/>
<fo:region-after region-name="footer-rest" extent="0.5cm"/>
</fo:simple-page-master>

<fo:page-sequence-master master-name="document">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference page-position="first" master-reference="firstPage"/>
<fo:conditional-page-master-reference page-position="rest" master-reference = "otherPage" />
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>

</fo:layout-master-set>

<fo:page-sequence master-reference="document">
<fo:static-content flow-name="header-rest">
<fo:block text-align="center">Header of First page.</fo:block>
</fo:static-content>

<fo:static-content flow-name="footer-first">
<fo:block text-align="center">First page.</fo:block>
</fo:static-content>

<fo:static-content flow-name="footer-rest">
<fo:block text-align-last="center">Other page.</fo:block>
</fo:static-content>

<!-- BODY -->
<fo:flow flow-name="xsl-region-body">
<fo:block text-align="center">THIS is BODY</fo:block>
</fo:flow>
</fo:page-sequence>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.