Thanks for the instant reply
Please find my xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform" xmlns:fo="
http://www.w3.org/1999/XSL/Format" xmlns:xalan="
http://xml.apache.org/xalan" xmlns:java="
http://xml.apache.org/xslt/java">
<xsl:output method="xml" indent="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<fo:root>
<!-- ================================================================ -->
<!-- Page Setup. -->
<!-- ================================================================ -->
<fo:layout-master-set>
<fo:simple-page-master master-name="main" page-width="210mm" page-height="297mm" margin-top="10mm" margin-bottom="10mm" margin-right="3mm" margin-left="1cm">
<fo:region-body margin-top="7mm"/>
<fo:region-before extent="5mm"/>
<fo:region-after extent="5in" region-name="footer"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="second" page-width="210mm" page-height="297mm" margin-top="10mm" margin-bottom="10mm" margin-right="3mm" margin-left="1cm">
<fo:region-body margin-top="7mm"/>
<fo:region-before extent="5mm"/>
<fo:region-start margin-top="5mm" extent="7.5in" region-name="header-second"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="rest" page-width="210mm" page-height="297mm" margin-top="10mm" margin-bottom="10mm" margin-right="3mm" margin-left="1cm">
<fo:region-body margin-top="7mm"/>
<fo:region-before extent="5mm"/>
<fo:region-start margin-top="5mm" extent="7.5in" region-name="header-rest"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="mainpage">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="main"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
<fo:page-sequence-master master-name="secondandrest">
<fo:single-page-master-reference master-reference="second"/>
<fo:repeatable-page-master-reference master-reference="rest"/>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="mainpage">
<fo:static-content flow-name="footer">
<!-- Some data -->
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<!-- ================================================================ -->
<!-- CHECK FIRST PAGE CONTENT -->
<!-- ================================================================ -->
<xsl:if test="count(EOP/CHCK) >0">
<fo:block end-indent="10pt" text-align="end" white-space-collapse="false" font-family="Courier New, Courier" font-size="9pt" font-weight="bold">
<fo:page-number/> of <fo:page-number-citation ref-id="terminator"/></fo:block>
<!-- some business logic -->
</xsl:if>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="secondandrest">
<fo:static-content flow-name="header-second">
<!-- ================================================================ -->
<!-- CHECK HEADER SECOND PAGE CONTENT -->
<!-- ================================================================ -->
<xsl:if test="count(EOP/CHCK/DETL) >0">
<fo:block text-align="end" white-space-collapse="false" font-family="Courier New, Courier" font-size="9pt" font-weight="bold">
<fo:page-number/> of <fo:page-number-citation ref-id="terminator"/></fo:block>
</xsl:if>
</fo:static-content>
<fo:static-content text-align="left" flow-name="header-rest">
<!-- header rest of the pages -->
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<!-- ================================================================ -->
<!-- for other groups -->
<!-- ================================================================ -->
<xsl:if test="count(EOP/EFT) >0">
<!-- I have to have this id as sometimes it goes to the other loop and based on some other business logic, comes to this loop
<fo:block id="terminator"/>
</xsl:if>
<!-- ================================================================ -->
<!-- for other business CONTENT -->
<!-- ================================================================ -->
<xsl:if test="count(EOP/CHCK) >0">
<!-- business logic again -->
<fo:block id="terminator"/>
</xsl:if>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
The problem is if the page content is more than 2 pages, it display to pefection. But if the page is 1, it displays as 1 of 2 and the second page blank. IN fact , it should be 1 of 1 and no second page at all. Hope i made sense. Thanks a lot for helping me