web analytics

Location of static contents in XSL-FO

Options

codeling 1599 - 6654
@2016-03-22 09:53:48

All static contents must be positioned before all flows inside a page sequence.

For example, this XSL-FO will generate a strict formatting error, because the second static content is positioned after the flow:

<?xml version="1.0" encoding="utf-8"?>

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

       <fo:layout-master-set>

               <fo:simple-page-master master-name="all-pages" page-width="8.5in" page-height="11in">

                       <fo:region-body padding="6pt" margin="0.7in" region-name="xsl-region-body" column-gap="0.25in"/>

                       <fo:region-before padding="6pt" region-name="xsl-region-before" display-align="after" extent="0.7in"/>

                       <fo:region-after padding="6pt" region-name="xsl-region-after" display-align="before" extent="0.7in"/>

               </fo:simple-page-master>

               <fo:page-sequence-master master-name="default-sequence">

                       <fo:repeatable-page-master-reference master-reference="all-pages"/>

               </fo:page-sequence-master>

       </fo:layout-master-set>

       <fo:page-sequence master-reference="default-sequence">

               <fo:static-content flow-name="xsl-region-before" font-size="12pt" font-family="Times New Roman">

                       <fo:block>sample header</fo:block>

               </fo:static-content>

               <fo:flow flow-name="xsl-region-body" font-size="12pt" font-family="Times New Roman">

                       <fo:block>sample text</fo:block>

               </fo:flow>

               <fo:static-content flow-name="xsl-region-after" font-size="12pt" font-family="Times New Roman">

                       <fo:block>sample footer</fo:block>

               </fo:static-content>

       </fo:page-sequence>

</fo:root>

The following XSL-FO will render fine:

<?xml version="1.0" encoding="utf-8"?>

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

       <fo:layout-master-set>

               <fo:simple-page-master master-name="all-pages" page-width="8.5in" page-height="11in">

                       <fo:region-body padding="6pt" margin="0.7in" region-name="xsl-region-body" column-gap="0.25in"/>

                       <fo:region-before padding="6pt" region-name="xsl-region-before" display-align="after" extent="0.7in"/>

                       <fo:region-after padding="6pt" region-name="xsl-region-after" display-align="before" extent="0.7in"/>

               </fo:simple-page-master>

               <fo:page-sequence-master master-name="default-sequence">

                       <fo:repeatable-page-master-reference master-reference="all-pages"/>

               </fo:page-sequence-master>

       </fo:layout-master-set>

       <fo:page-sequence master-reference="default-sequence">

               <fo:static-content flow-name="xsl-region-before" font-size="12pt" font-family="Times New Roman">

                       <fo:block>sample header</fo:block>

               </fo:static-content>

               <fo:static-content flow-name="xsl-region-after" font-size="12pt" font-family="Times New Roman">

                       <fo:block>sample footer</fo:block>

               </fo:static-content>

               <fo:flow flow-name="xsl-region-body" font-size="12pt" font-family="Times New Roman">

                       <fo:block>sample text</fo:block>

               </fo:flow>

       </fo:page-sequence>

</fo:root>

Comments

You must Sign In to comment on this topic.


© 2024 Digcode.com