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 Jane <da...@yahoo.com> on 2002/10/09 17:13:33 UTC
XSL - Title on the 1st Page
Hello,
We like to put a report name only on the first page in our PDF file generated from XSL & XML. We tried to put it in "page-sequence" block but it is displayed on all the pages.
The attached is our XSL file and if any one could let us know how to change to show the report name on the first page, we would appreciate very much.
Thanks a lot for your time in advance.
Jane
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:param name="tablewidth" select="45"/>
<xsl:param name="rows-per-page-sequence" select="10000"/>
<xsl:template match="RESULT">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master
master-name="dibi-pdf"
page-width="50cm" page-height="40cm"
margin-top="0.5cm" margin-bottom="0.5cm"
margin-left="1cm" margin-right="0.5cm">
<fo:region-body margin-top="1in" margin-bottom="0.5in" margin-right="0.2in" margin-left="0.5in" />
<fo:region-before extent="0.5in"/>
<fo:region-after extent="0.5in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<xsl:variable name="colheader" select="COLUMN/col"/>
<xsl:variable name="colwidth" select="$tablewidth div count(COLUMN/col)"/>
<xsl:variable name="col4rows" select="COL4ROW/col4row"/>
<xsl:variable name="title" select="HEADER"/>
<xsl:for-each select="ROW/DATA[position() mod $rows-per-page-sequence = 1]">
<fo:page-sequence master-reference="dibi-pdf">
<!-- This is the page footer for page number. -->
<fo:static-content flow-name="xsl-region-after">
<fo:block text-align="center" font-size="10pt" line-height="1em + 2pt">
Page <fo:page-number/>
</fo:block>
</fo:static-content>
<!-- This is the report name that should be shown on just the 1st page. -->
<fo:static-content flow-name="xsl-region-before">
<fo:block text-align="center" font-size="20pt" line-height="1em + 2pt">
<xsl:value-of select="$title"/>
</fo:block>
</fo:static-content>
<!-- This begins the page body content. -->
<fo:flow flow-name="xsl-region-body"> ...
</fo:flow>
</fo:page-sequence>
</xsl:for-each>
</fo:root> <!-- Root element template stops here. -->
</xsl:template>
</xsl:stylesheet>
---------------------------------
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos, & more
faith.yahoo.com
Re: XSL - Title on the 1st Page
Posted by Jane <da...@yahoo.com>.
Hi, Rodolphe,
We modifed our XSL based on your sample code and it worked!
We appreciate very much for your help and the help from a couple of other folks.
Jane
Rodolphe VAGNER wrote:This should work. <!--page 1 for toc-->
<fo:simple-page-master master-name="FirstOfTOC"
page-height="279mm"
page-width="215mm"
margin-top="5mm"
margin-bottom="5mm"
margin-right="16mm"
margin-left="29mm">
<fo:region-body margin-top="35mm"
margin-bottom="25mm"/>
<fo:region-before region-name="region-before-TOC-page1"
extent="35mm"/>
<fo:region-after extent="25mm"/>
</fo:simple-page-master>
<!-- Others for TOC--><fo:simple-page-master master-name="nextOfTOC"
page-height="279mm"
page-width="215mm"
margin-top="5mm"
margin-bottom="5mm"
margin-right="16mm"
margin-left="29mm">
<fo:region-body margin-top="35mm"
margin-bottom="25mm" />
<fo:region-before region-name="region-before-TOC-pages-gt-1"
extent="35mm"/>
<fo:region-after extent="25mm"/>
</fo:simple-page-master>
...<fo:page-sequence-master master-name="MYTOC">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="NextOfTOC" page-position="rest" />
<fo:conditional-page-master-reference master-reference="firstOfTOC" page-position="first"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
<fo:page-sequence master-reference="MYTOC">
<fo:static-content flow-name="region-before-TOC-page1">
<!--Bla Bla--> </fo:static-content>
<fo:static-content flow-name="region-before-TOC-pages-gt-1"><!--Bla Bla-->
</fo:static-content> ----- Original Message ----- From: Jane To: fop-user@xml.apache.org Cc: mpatel@deloitte.com Sent: Wednesday, October 09, 2002 5:13 PMSubject: XSL - Title on the 1st Page
Hello,
We like to put a report name only on the first page in our PDF file generated from XSL & XML. We tried to put it in "page-sequence" block but it is displayed on all the pages.
The attached is our XSL file and if any one could let us know how to change to show the report name on the first page, we would appreciate very much.
Thanks a lot for your time in advance.
Jane
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:param name="tablewidth" select="45"/>
<xsl:param name="rows-per-page-sequence" select="10000"/>
<xsl:template match="RESULT">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master
master-name="dibi-pdf"
page-width="50cm" page-height="40cm"
margin-top="0.5cm" margin-bottom="0.5cm"
margin-left="1cm" margin-right="0.5cm">
<fo:region-body margin-top="1in" margin-bottom="0.5in" margin-right="0.2in" margin-left="0.5in" />
<fo:region-before extent="0.5in"/>
<fo:region-after extent="0.5in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<xsl:variable name="colheader" select="COLUMN/col"/>
<xsl:variable name="colwidth" select="$tablewidth div count(COLUMN/col)"/>
<xsl:variable name="col4rows" select="COL4ROW/col4row"/>
<xsl:variable name="title" select="HEADER"/>
<xsl:for-each select="ROW/DATA[position() mod $rows-per-page-sequence = 1]">
<fo:page-sequence master-reference="dibi-pdf">
<!-- This is the page footer for page number. -->
<fo:static-content flow-name="xsl-region-after">
<fo:block text-align="center" font-size="10pt" line-height="1em + 2pt">
Page <fo:page-number/>
</fo:block>
</fo:static-content>
<!-- This is the report name that should be shown on just the 1st page. -->
<fo:static-content flow-name="xsl-region-before">
<fo:block text-align="center" font-size="20pt" line-height="1em + 2pt">
<xsl:value-of select="$title"/>
</fo:block>
</fo:static-content>
<!-- This begins the page body content. -->
<fo:flow flow-name="xsl-region-body"> ...
</fo:flow>
</fo:page-sequence>
</xsl:for-each>
</fo:root> <!-- Root element template stops here. -->
</xsl:template>
</xsl:stylesheet>
---------------------------------
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos, & more
faith.yahoo.com
---------------------------------
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos, & more
faith.yahoo.com
Re: XSL - Title on the 1st Page
Posted by Rodolphe VAGNER <ro...@eurodoc-sofilog.com>.
This should work.
<!--page 1 for toc-->
<fo:simple-page-master master-name="FirstOfTOC"
page-height="279mm"
page-width="215mm"
margin-top="5mm"
margin-bottom="5mm"
margin-right="16mm"
margin-left="29mm">
<fo:region-body margin-top="35mm"
margin-bottom="25mm"/>
<fo:region-before region-name="region-before-TOC-page1"
extent="35mm"/>
<fo:region-after extent="25mm"/>
</fo:simple-page-master>
<!-- Others for TOC-->
<fo:simple-page-master master-name="nextOfTOC"
page-height="279mm"
page-width="215mm"
margin-top="5mm"
margin-bottom="5mm"
margin-right="16mm"
margin-left="29mm">
<fo:region-body margin-top="35mm"
margin-bottom="25mm" />
<fo:region-before region-name="region-before-TOC-pages-gt-1"
extent="35mm"/>
<fo:region-after extent="25mm"/>
</fo:simple-page-master>
.
.
.
<fo:page-sequence-master master-name="MYTOC">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="NextOfTOC" page-position="rest" />
<fo:conditional-page-master-reference master-reference="firstOfTOC" page-position="first"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
<fo:page-sequence master-reference="MYTOC">
<fo:static-content flow-name="region-before-TOC-page1">
<!--Bla Bla-->
</fo:static-content>
<fo:static-content flow-name="region-before-TOC-pages-gt-1">
<!--Bla Bla-->
</fo:static-content>
----- Original Message -----
From: Jane
To: fop-user@xml.apache.org
Cc: mpatel@deloitte.com
Sent: Wednesday, October 09, 2002 5:13 PM
Subject: XSL - Title on the 1st Page
Hello,
We like to put a report name only on the first page in our PDF file generated from XSL & XML. We tried to put it in "page-sequence" block but it is displayed on all the pages.
The attached is our XSL file and if any one could let us know how to change to show the report name on the first page, we would appreciate very much.
Thanks a lot for your time in advance.
Jane
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:param name="tablewidth" select="45"/>
<xsl:param name="rows-per-page-sequence" select="10000"/>
<xsl:template match="RESULT">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master
master-name="dibi-pdf"
page-width="50cm" page-height="40cm"
margin-top="0.5cm" margin-bottom="0.5cm"
margin-left="1cm" margin-right="0.5cm">
<fo:region-body margin-top="1in" margin-bottom="0.5in" margin-right="0.2in" margin-left="0.5in" />
<fo:region-before extent="0.5in"/>
<fo:region-after extent="0.5in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<xsl:variable name="colheader" select="COLUMN/col"/>
<xsl:variable name="colwidth" select="$tablewidth div count(COLUMN/col)"/>
<xsl:variable name="col4rows" select="COL4ROW/col4row"/>
<xsl:variable name="title" select="HEADER"/>
<xsl:for-each select="ROW/DATA[position() mod $rows-per-page-sequence = 1]">
<fo:page-sequence master-reference="dibi-pdf">
<!-- This is the page footer for page number. -->
<fo:static-content flow-name="xsl-region-after">
<fo:block text-align="center" font-size="10pt" line-height="1em + 2pt">
Page <fo:page-number/>
</fo:block>
</fo:static-content>
<!-- This is the report name that should be shown on just the 1st page. -->
<fo:static-content flow-name="xsl-region-before">
<fo:block text-align="center" font-size="20pt" line-height="1em + 2pt">
<xsl:value-of select="$title"/>
</fo:block>
</fo:static-content>
<!-- This begins the page body content. -->
<fo:flow flow-name="xsl-region-body"> ...
</fo:flow>
</fo:page-sequence>
</xsl:for-each>
</fo:root> <!-- Root element template stops here. -->
</xsl:template>
</xsl:stylesheet>
------------------------------------------------------------------------------
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos, & more
faith.yahoo.com
Re: XSL - Title on the 1st Page
Posted by Oleg Tkachenko <ol...@multiconn.com>.
Jane wrote:
> We like to put a report name only on the first page in our PDF file
> generated from XSL & XML. We tried to put it in "page-sequence" block
> but it is displayed on all the pages.
That's xsl-fo basics, look at
http://www.dpawson.co.uk/xsl/sect3/bk/ch05.html#pseqs
--
Oleg Tkachenko
eXperanto team
Multiconn International, Israel
Re: XSL - Title on the 1st Page
Posted by Konstantin Priblouda <kp...@yahoo.com>.
--- Jane <da...@yahoo.com> wrote:
>
> Hello,
>
> We like to put a report name only on the first page
> in our PDF file generated from XSL & XML. We tried
> to put it in "page-sequence" block but it is
> displayed on all the pages.
>
> The attached is our XSL file and if any one could
> let us know how to change to show the report name on
> the first page, we would appreciate very much.
>
> Thanks a lot for your time in advance.
Do it like this:
( do'n be affraid - there are some german words)
--------%<--------------
<fo:layout-master-set>
<fo:simple-page-master
master-name="first"
margin-right="1.5cm" margin-left="1.5cm"
margin-bottom="0cm" margin-top="0cm"
page-width="21cm" page-height="29.7cm" >
<fo:region-body
margin-top="12cm"
margin-bottom="3cm"
margin-left="0pt"
margin-right="0pt"
/>
<fo:region-before extent="12cm"
region-name="bill-header"/>
<fo:region-after extent="0cm"/>
</fo:simple-page-master>
<fo:simple-page-master
master-name="consecutive"
margin-right="1.5cm" margin-left="1.5cm"
margin-bottom="0cm" margin-top="0cm"
page-width="21cm" page-height="29.7cm" >
<fo:region-body
margin-top="5.5cm"
margin-bottom="3cm"
margin-left="0pt"
margin-right="0pt"
/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="run">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference
master-reference="first"
page-position="first"/>
<fo:conditional-page-master-reference
master-reference="consecutive"
odd-or-even="any"
/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="run">
<fo:static-content flow-name="bill-header">
<fo:block-container position="absolute"
top="6.5cm" left="0cm" height="3cm" width="10cm">
<fo:block text-align="start" $textfont>
$!bill.billingAddress.description
</fo:block>
<fo:block text-align="start" $textfont>
$!bill.billingAddress.street
</fo:block>
<fo:block text-align="start" $textfont
space-before="0.5cm">
$!bill.billingAddress.zip $!bill.billingAddress.city
</fo:block>
</fo:block-container>
<fo:block-container position="absolute"
top="9.2cm" left="0cm" height="0.8cm" width="10cm">
<fo:block text-align="start" $textfont>
UST.-Nr.: 4084631924-G10
</fo:block>
</fo:block-container>
<fo:block-container position="absolute"
top="10.8cm" left="0cm" height="1.2cm" width="10cm">
<fo:block text-align="start" $textfont>
Rechnungs-Nr.: $billId
</fo:block>
<fo:block text-align="start" $textfont>
Kd.-Nr.: $bill.customerId
</fo:block>
</fo:block-container>
<fo:block-container position="absolute"
top="10.8cm" left="12.5cm" height="0.8cm" width="7cm">
<fo:block text-align="start" $textfont>
Rechnungsdatum: $currentDate
</fo:block>
</fo:block-container>
</fo:static-content>
--------%<--------------
regards,
=====
Konstantin Priblouda ( ko5tik ) Freelance Software developer
< http://www.pribluda.de > < play java games -> http://www.yook.de >
< render charts online -> http://www.pribluda.de/povray/ >
__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com