[xsl] Page Numbers

Subject: [xsl] Page Numbers
From: "Tanzila Mohammad" <tmohammad@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 30 Nov 2001 14:24:34 -0000
I am using XSL:FO to position the page numbers but they appear on the same
side of the page. I have named the regions differently but still the error
... As illustrated below.

My Output (where 12 and 13 are the page numbers and they are given in
relation to their page position):

   Table 7   12
   Table 8

   Table 9   13
   Table 10

and if the data on page 12 overuns then
   Table 7  12
   Table 8

   Table 8 cont.. 13

13 Table 9
   Table 10

My Desired Output:

12   Table 7
     Table 8

     Table 9   13
     Table 10

My XML is:

<ybml>
	<query-result>
   		<yearbook id="fzyb" volume="50" year="2000">
			<table-header>
				<table-header-literals>
					<literal name="number">7</literal>
                              <literal name="startpage">12</literal>
					........
				</table-header-literals>
				etc...
		</yearbook>
            <yearbook id="fzyb" volume="50" year="2000">
			<table-header>
				<table-header-literals>
					<literal name="number">8</literal>
                               <literal name="startpage">12</literal>
                                ........
                        </table-header-literals>
				etc...
		</yearbook>
	</query-result>
	<query-result xmlns:faostat="http://www.fao.org/faostat";>
           <yearbook id="fzyb" volume="50" year="2000">
			<table-header>
				<table-header-literals>
					<literal name="number">9</literal>
                              <literal name="startpage">13</literal>
					.......
				</table-header-literals>
				etc..
		</yearbook>
            <yearbook id="fzyb" volume="50" year="2000">
			<table-header>
				<table-header-literals>
                               <literal name="number">10</literal>
                               <literal name="startpage">13</literal>
					.....
				</table-header-literals>
		</yearbook>
	</query-result>
</ybml>

I have the following XSLT code:

<xsl:for-each select="ybml/query-result">
 <fo:layout-master-set>
		<fo:simple-page-master master-name="rightPage"
			page-height="29.7cm"
			page-width="21cm"
			margin-left="1.3cm"
			margin-right="1.3cm"
			margin-top="0.2cm"
			margin-bottom="0.5cm">
			<fo:region-before region-name="rightHeader"
                                          extent="0.5cm" precedence="true"/>
			<fo:region-after extent="1.5cm"/>
			<fo:region-body
				margin-top="0.5cm"
				margin-bottom="1.5cm"/>
		</fo:simple-page-master>

 <fo:simple-page-master master-name="leftPage"
			page-height="29.7cm"
			page-width="21cm"
			margin-left="1.3cm"
			margin-right="1.3cm"
			margin-top="0.2cm"
			margin-bottom="0.5cm">
			<fo:region-before region-name="leftHeader"
                                          extent="0.5cm" precedence="true"/>
			<fo:region-after extent="1.5cm"/>
			<fo:region-body
				margin-top="0.5cm"
				margin-bottom="1.5cm" />
		</fo:simple-page-master>

     <!-- Set up the sequence of pages -->
		<fo:page-sequence-master master-name="contents">
			<fo:repeatable-page-master-alternatives>
				<fo:conditional-page-master-reference
					master-name="rightPage"
					odd-or-even="odd"
                                 />
                                <fo:conditional-page-master-reference
					   master-name="leftPage"
					   odd-or-even="even"
                               />
			</fo:repeatable-page-master-alternatives>
		</fo:page-sequence-master>

      </fo:layout-master-set>

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

  <xsl:apply-templates
select="./yearbook/table-header/table-header-literals"/>

   <xsl:call-template name="rightpageHeader"/>
   <xsl:call-template name="leftpageHeader"/>
   <xsl:call-template name="footer"/>
   <xsl:call-template name="bodyContents"/>

 </fo:page-sequence>
</xsl:for-each>
</fo:root>
</xsl:template>

<xsl:template name="rightpageHeader">

  	<fo:static-content flow-name="rightHeader">

        <fo:block font-family="Courier" font-size="11px"
                       text-align="start" space-after.optimum="5pt">
                 <fo:page-number/>
             </fo:block>

    </fo:static-content>
</xsl:template>

<xsl:template name="leftpageHeader">
	<fo:static-content flow-name="leftHeader">
                 <fo:block font-family="Courier" font-size="11px"
                       text-align="end" space-after.optimum="5pt">
                 <fo:page-number/>
                </fo:block>
      </fo:static-content>
</xsl:template>

Any help greatly appreciated.

Tanz


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread