[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

fo:table problem (using Apache FOP)

Subject: fo:table problem (using Apache FOP)
From: "Sami, Abdul (Netprosys)" <asami@xxxxxxxxxx>
Date: Mon, 4 Feb 2002 17:19:19 -0800
fop if test
I am using Xsl to genrate Pdf report(Apache FOP). The problem i am facing is
that it leaves a  big margin at the bottom of each page.
I want it should leave space just as the Footer defined. But it leaves a lot
of space and change the page.


Please have a look on <fo:layout-master-set>, <fo:table>, <fo:table-row> so
you may found the problem.

If someone can email me the sample xsl that is working fine with table that
span on multiple pages then i might figure out the problem.


Sami


<xsl:stylesheet
	 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
	 xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
	<fo:layout-master-set>
		<fo:simple-page-master
			margin-right="1.5cm"
			margin-left="1.5cm"
			margin-bottom="2cm"
			margin-top="1cm"
			page-width="21.59cm"
			page-height="27.94cm"
			master-name="first">
			<fo:region-before extent="6cm"/>
			<fo:region-body margin-top="2.5cm"/>
			<fo:region-after extent="1.5cm"/>
		</fo:simple-page-master>
	</fo:layout-master-set>

	<fo:page-sequence master-name="first">
		<fo:static-content flow-name="xsl-region-before">
			<xsl:apply-templates select="report/header" />
		</fo:static-content>


		<fo:flow flow-name="xsl-region-body">
		<fo:block padding-left="5cm">
			<fo:table space-after.optimum="1pt" width="15cm">
				<fo:table-column column-width="12cm"/>
				<fo:table-column column-width="3cm"/>
				<fo:table-body>
					<xsl:apply-templates
select="report/components" />
				</fo:table-body>
			</fo:table>
		</fo:block>
	</fo:flow>
  </fo:page-sequence>
</fo:root>
</xsl:template>

<xsl:template match="header">
	<fo:table space-after.optimum="1pt">
		<fo:table-column column-width="9cm"/>
		<fo:table-column column-width="9cm"/>
		<fo:table-body>
			<xsl:apply-templates select="lines" />
		</fo:table-body>
	</fo:table>

</xsl:template>

<xsl:template match="header/lines">
	<xsl:for-each select="line">
		<xsl:if test="position()=1">
			<fo:table-row space-after.optimum="1pt">
				<fo:table-cell number-columns-spanned="2">
					<fo:block space-before.optimum="3pt"
space-after.optimum="5pt" line-height="12pt" font-size="10pt">
						<xsl:value-of select="left"
/>
					</fo:block>
				</fo:table-cell>
			</fo:table-row>
		</xsl:if>
		<xsl:if test="position()=2">
			<fo:table-row line-height="14pt"
background-color="#EEEEEE">
				<fo:table-cell>
					<fo:block font-size="12pt"
font-weight="bold" space-before.optimum="3pt" margin-left="3pt">
						<xsl:value-of select="left"
/>
					</fo:block>
				</fo:table-cell>
				<fo:table-cell>
					<fo:block text-align="end"
font-size="9pt"  font-weight="bold">
						<xsl:value-of select="right"
/>
					</fo:block>
				</fo:table-cell>
			</fo:table-row>
		</xsl:if>
		<xsl:if test="position()=3">
			<fo:table-row space-after.optimum="12pt"
background-color="#EEEEEE" line-height="12pt">
				<fo:table-cell>

					<fo:block font-size="9pt"
space-before.optimum="3pt" margin-left="3pt">
						<xsl:call-template
name="space-4" />
						<xsl:value-of select="left"
/>
					</fo:block>
				</fo:table-cell>
				<fo:table-cell>
					<fo:block text-align="end"
font-size="9pt"  font-weight="bold">
						<xsl:value-of select="right"
/>
					</fo:block>
				</fo:table-cell>
			</fo:table-row>
		</xsl:if>
	</xsl:for-each>
</xsl:template>

<xsl:template match="components" >
	<xsl:apply-templates select="component" />
</xsl:template>

<xsl:template match="component">
	<xsl:apply-templates select="row | heading | summary" />
</xsl:template>

<xsl:template match="row">
	<fo:table-row font-size="10pt" border-bottom-color="black"
border-bottom-width="1pt" border-bottom-style="solid"
space-before.optimum="2pt">
		<xsl:for-each select="cell">
			<fo:table-cell>
				<xsl:if test="position()=1">
					<xsl:call-template
name="left-data-block" />
				</xsl:if>
				<xsl:if test="position()=2">
					<xsl:call-template
name="center-data-block" />
				</xsl:if>
			</fo:table-cell>
		</xsl:for-each>
	</fo:table-row>
</xsl:template>

<xsl:template name="left-data-block">
	<fo:block text-align="start">
		<xsl:value-of select="content" />
	</fo:block>
</xsl:template>

<xsl:template name="center-data-block">
	<fo:block text-align="center">
		<xsl:value-of select="content" />
	</fo:block>
</xsl:template>


<xsl:template name="right-data-block">
	<fo:block text-align="end">
		<xsl:value-of select="content" />
	</fo:block>
</xsl:template>


<xsl:template name="left-indented-data-block">
	<fo:block text-align="start">
		<xsl:call-template name="space-4" />
		<xsl:value-of select="content" />
	</fo:block>
</xsl:template>


<xsl:template name="space-1">
<fo:inline white-space-collapse="false"><fo:character character='
'/></fo:inline>
</xsl:template>

<xsl:template name="space-4">
	<xsl:call-template name="space-1" />
	<xsl:call-template name="space-1" />
	<xsl:call-template name="space-1" />
	<xsl:call-template name="space-1" />
</xsl:template>

<xsl:template match="heading">
	<fo:table-row line-height="20pt" font-size="11pt"
background-color="#EEEEEE" space-after.optimum="8pt"  font-weight="bold"
padding-left="3px" border-color="black" border-width="1pt"
border-style="solid">
		<xsl:for-each select="cell">
			<fo:table-cell>
				<xsl:if test="position()=1">
					<xsl:call-template
name="left-data-block" />
				</xsl:if>
				<xsl:if test="not(position()=1)">
					<xsl:call-template
name="center-data-block" />
				</xsl:if>

			</fo:table-cell>
		</xsl:for-each>
	</fo:table-row>
</xsl:template>

<xsl:template match="summary">
	<fo:table-row line-height="20pt" font-size="11pt"
space-after.optimum="8pt" font-weight="bold"  border-top-color="black"
border-top-width="1pt" border-top-style="solid">
		<xsl:for-each select="cell">
			<fo:table-cell>
				<xsl:if test="position()=1">
					<xsl:call-template
name="left-data-block" />
				</xsl:if>
				<xsl:if test="position()=2">
					<xsl:call-template
name="center-data-block" />
				</xsl:if>
			</fo:table-cell>
		</xsl:for-each>
	</fo:table-row>
</xsl:template>



</xsl:stylesheet>



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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.