This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fo:table problem (using Apache FOP)


"Sami, Abdul (Netprosys)" <asami@spbank.com> wrote:
> 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.

I was not able to reproduce the problem. I may have misunderstood
your question, or the problem depends on the XML input which you didn't
supply. In general, if you have questions pertaining FO, it's prudent
to post the FO file (trimmed down as much as possible), or post both
the XSLT and a sample XML which exhibits the problem. It also often
helps to note the version number of the software you are using.

However, there are some general remarks:
> <fo:simple-page-master ... 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>

Your regions overlap. In most cases, this is not the intention.
In order to avoid surprises, it is advisable that the margin-top
of the region-body matches the extend of region-before, and
margin-bottom of region-body matches the extend of region-after.

> <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 ...>
>            <xsl:value-of select="left"

Having a xsl:for-each and a set of exclusive xsl:if is odd.
You could simply write
  <xsl:template match="header/lines">
    <fo:table-row space-after.optimum="1pt">
       <fo:table-cell number-columns-spanned="2">
          <fo:block ...>
             <xsl:value-of select="lines[1]/left"
                                        ^^^
and so on.

> <xsl:template match="row">
> ...
>   <xsl:for-each select="cell">
>    <fo:table-cell>
>      <xsl:if test="position()=1">
>        <xsl:call-template name="left-data-block" />

Same here, even though using the context within the called
template seems to complicate it. You can pass the element to be
formatted as a parameter, or since the called templates actually
don't do something significant, you can always inline them (like
it is done for formatting the page header lines).

> <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>

Using spaces for indentation has some pitfalls and is therefore
discouraged (and may get you tarred and feathered if you had claimed
professionality in typesetting before).
You should use text-indent, for example:
  <fo:block text-indent="1en"> ...

HTH
J.Pietschmann

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]