I have created a page sequence for a manual of 25 pages and using xsl-fo for pdf output. I was not happy with pdf output. Because, condition-sequence for odd and even pages, was not which I expected. I have attached my xsl file for the reference and guide me, which part of coding was wrong. Let me explain, how exactly my pages should be.
Firstly, I want a copy right page, without any header or footer.
Secondly, a blank page.
Thirdly, Table of contents pages, with a roman page number at the footer.
Fourthly, again a blank page.
Fifthly, a title page only footer with roman page number as 1.
Sixthly, continuous even and odd pages with both a header and footer, along with a page number continuously.
Regards,
Prabhu.I
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0" encoding="UTF-8"?>
- <xsl:stylesheet version="2.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:fo="http://www.w3.org/1999/XSL/Format">
- <xsl:template match="chapter">
- <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
- <fo:layout-master-set>
- <fo:simple-page-master
- master-name="copyright"
- page-height="29.7cm"
- page-width="21.0cm"
- margin-top="2cm"
- margin-bottom="2cm"
- margin-left="2.5cm" margin-right="2.5cm">
- <fo:region-body
- margin-top="10cm"
- margin-bottom="2cm"/>
- <fo:region-after extent="2cm"/>
- </fo:simple-page-master>
- <fo:simple-page-master master-name="Toc"
- page-height="29.7cm"
- page-width="21cm"
- margin-top="1in"
- margin-bottom="1.5in"
- margin-left="2.5cm"
- margin-right="2.5cm">
- <fo:region-body
- padding-start="0cm"
- padding-end="0cm"
- margin-top="0.6in"
- margin-bottom="0.6in"
- margin-left="0.7in"
- margin-right="0.5in"/>
- </fo:simple-page-master>
- <fo:simple-page-master master-name="first"
- page-height="29.7cm"
- page-width="21cm"
- margin-left="2.5cm"
- margin-right="2.5cm"
- margin-top="1cm"
- margin-bottom="2cm">
- <fo:region-body margin-top="2cm" margin-bottom="3cm"/>
- <fo:region-before extent="3cm"/>
- <fo:region-after region-name="footer" extent="1.5cm"/>
- <fo:region-start extent="2cm"/>
- <fo:region-end extent="2cm"/>
- </fo:simple-page-master>
- <fo:simple-page-master
- master-name="odd"
- page-height="29.7cm"
- page-width="21.0cm"
- margin-top="2cm"
- margin-bottom="2cm"
- margin-left="3.5cm"
- margin-right="1.5cm">
- <fo:region-body
- margin-top="2cm"
- margin-bottom="2cm"/>
- <fo:region-before
- region-name="oddhead"
- extent="2cm"/>
- <fo:region-after
- region-name="oddfoot"
- extent="2cm"/>
- </fo:simple-page-master>
- <fo:simple-page-master
- master-name="even"
- page-height="29.7cm"
- page-width="21.0cm"
- margin-top="2cm"
- margin-bottom="2cm"
- margin-left="1.5cm"
- margin-right="3.5cm">
- <fo:region-body
- margin-top="2cm"
- margin-bottom="2cm"/>
- <fo:region-before
- region-name="evenhead"
- extent="2cm"/>
- <fo:region-after
- region-name="evenfoot"
- extent="2cm"/>
- </fo:simple-page-master>
- <fo:page-sequence-master master-name="Chapter">
- <fo:repeatable-page-master-alternatives>
- <fo:conditional-page-master-reference
- master-reference="odd" odd-or-even="odd" page-position="rest"/>
- <fo:conditional-page-master-reference
- master-reference="even" odd-or-even="even" page-position="rest"/>
- <fo:conditional-page-master-reference
- master-reference="first"
- page-position="first" />
- </fo:repeatable-page-master-alternatives>
- </fo:page-sequence-master>
- </fo:layout-master-set>
- <fo:page-sequence
- master-reference="copyright">
- <fo:flow
- flow-name="xsl-region-body">
- <fo:block>
- <xsl:value-of select="/copyrights1/body/bodyindent"/>
- </fo:block>
- </fo:flow>
- </fo:page-sequence>
- <fo:page-sequence master-reference="Chapter" >
- <fo:static-content flow-name="footer">
- <fo:block text-align="center" font-family="times new roman" font-size="12pt">
- </fo:block>
- </fo:static-content>
- <fo:static-content flow-name="oddhead">
- <fo:block border-bottom-width="thin"
- border-bottom-style="solid" border-bottom-color="black"
- font-family="times new roman" font-size="8pt" text-align="outside" >
- <fo:page-number />
- </fo:block>
- <fo:block font-family="times new roman" font-style="italic" font-size="10pt" text-align="outside" space-before="3pt">
- Quality Anylsis
- </fo:block>
- </fo:static-content>
- <fo:static-content flow-name="evenhead">
- <fo:block border-bottom-width="thin"
- border-bottom-style="solid" border-bottom-color="black"
- font-family="times new roman" font-size="8pt" text-align="inside">
- <fo:page-number />
- </fo:block>
- <fo:block font-family="times new roman" font-style="italic" font-size="10pt" text-align="inside" space-before="3pt">
- Quality Anylsis
- </fo:block>
- </fo:static-content>
- <fo:flow flow-name="xsl-region-body">
- <!--<xsl:apply-templates mode="toc"/>-->
- <xsl:apply-templates/>
- </fo:flow>
- </fo:page-sequence>
- </fo:root>