You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Maheswaran <Ma...@cognizant.com> on 2007/02/27 14:22:15 UTC

Header and Footer in new xsl

hi every one,
I am doing a report generation. I am using FOP to generate PDF file. I am
using xsl:fo for formatting.Presently i am defining the header, body, footer
in the same page master as follows

<fo:simple-page-master master-name="RejectedInput">
       <fo:region-before region-name="header-main" extent="50mm"/>
       <fo:region-body />
       <fo:region-after region-name="footer-main" extent="20mm" />
</fo:simple-page-master>

 I need to seperate the header and footer in seperate file so that any
change in the header and footer can be accomodated easily.

is it possible to get the header and footer from seperate xsl file and
import it to the main xsl file.
Can u guide me in this regard?...

 

-- 
View this message in context: http://www.nabble.com/Header-and-Footer-in-new-xsl-tf3300758.html#a9181870
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Header and Footer in new xsl

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Feb 27, 2007, at 14:22, Maheswaran wrote:

Hi,

> I am doing a report generation. I am using FOP to generate PDF  
> file. I am
> using xsl:fo for formatting.Presently i am defining the header,  
> body, footer
> in the same page master as follows
>
> <fo:simple-page-master master-name="RejectedInput">
>        <fo:region-before region-name="header-main" extent="50mm"/>
>        <fo:region-body />
>        <fo:region-after region-name="footer-main" extent="20mm" />
> </fo:simple-page-master>
>
>  I need to seperate the header and footer in seperate file so that any
> change in the header and footer can be accomodated easily.
>
> is it possible to get the header and footer from seperate xsl file and
> import it to the main xsl file.
> Can u guide me in this regard?...

If I understand the issue correctly, then I personally do something  
similar:
* the part above --the page-master-- still remains in the main .xsl file
* the fo:static-contents that will end up in those headers/footers  
are defined in named templates in a separate .xsl file, referenced by  
the main .xsl through xsl:include

Example:

In the separate stylesheet, name it 'headers-footers.xsl', you'll  
have some templates like:

<xsl:template name="Header">
   <fo:static-content flow-name="xsl-region-before">
     <fo:block>...</fo:block>
   </fo:static-content>
</xsl:template>

<xsl:template name="Footer">
   <fo:static-content flow-name="xsl-region-after">
     <fo:block>...</fo:block>
   </fo:static-content>
</xsl:template>

In the main .xsl, you'll then need something like:

<xsl:include href="./headers-footers.xsl" />
...
<xsl:template match="...">
   <fo:page-sequence master-reference="...">
     <xsl:call-template name="Header" />
     <xsl:call-template name="Footer" />
     <fo:flow flow-name="xsl-region-body">
     ....
     </fo:flow>
   </fo:page-sequence>
</xsl:template>


HTH!

Cheers,

Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org