Lien, Patrick
2004-03-08 03:31:39 UTC
I have 2 .fo files that I'm trying to integrate into a single XSL-FO
template that I hope to use to generate a 2-page PDF file. Each .fo file
uses all absolutely positioned block containers. They are, in fact, the
output from an FO editor (XSLFast).
I tried merging the .fo files and placing a break-before="page" in the 1st
block-container element that came from the second .fo file. Since all the
block-containers are absolutely positioned, this element is not necessarily
the first element that would normally be encountered in the flow.
However, the page break does not work, and I end up with a 1 page PDF with
the contents of both pages overlaid on top of each other.
I've also tried:
* Using break-after="page"
* Nesting the entire contents of the 1st and second pages in a
block-container element, but that did not work either.
How can I get a 2-page PDF from my .fo files?
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE xml [<!ENTITY copy "©"> <!ENTITY trade "™"> <!ENTITY
deg "°"> <!ENTITY gt ">"> <!ENTITY sup2 "²"> <!ENTITY
frac14 "¼"> <!ENTITY quot """> <!ENTITY frac12 "½">
<!ENTITY euro "€"> <!ENTITY Omega "Ω"> ]> <!-- Document
generated with XSLfast v1.3 -->
<xsl:stylesheet xmlns:fox="http://xml.apache.org/fop/extensions"
xmlns:print="http://www.jcatalog.com/com.jcatalog.output.xslextensions.print
.PrintElementFactory" xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://icl.com/saxon" extension-element-prefixes="saxon print"
<xsl:variable name="currentDate" >01-03-2004 10:47:11</xsl:variable>
<xsl:variable name="IMAGEEXT">gif</xsl:variable>
<xsl:template match="xml">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="pagemaster1"
page-height="792.0pt" page-width="612.0pt">
<fo:region-body margin-left="20pt" margin-top="8pt"
margin-bottom="8pt" margin-right="18pt"/>
<fo:region-before extent="8pt"/>
<fo:region-after extent="8pt" />
<fo:region-start extent="20pt" />
<fo:region-end extent="18pt" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="pagemaster1">
<fo:static-content flow-name="xsl-region-before" >
</fo:static-content>
<fo:static-content flow-name="xsl-region-after" >
</fo:static-content>
<fo:static-content flow-name="xsl-region-start" >
</fo:static-content>
<fo:static-content flow-name="xsl-region-end" >
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<xsl:apply-templates/>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="alphafactbookupdate">
<!-- *** Page 1 content *** -->
<fo:block-container position="absolute" top="183pt" left="390pt"
height="343.0pt" width="23.0pt" >
<fo:block>
<fo:instream-foreign-object>
<svg:svg xmlns:svg="http://www.w3.org/2000/svg" width = "8.0"
height="328.0">
<svg:g style="stroke:#b3b9c9; stroke-width:1.0">
<svg:line x1="2.0pt" y1="2.0pt" x2="2.0pt" y2="322.0pt" />
</svg:g>
</svg:svg>
</fo:instream-foreign-object>
</fo:block>
</fo:block-container>
<!-- OFFSET = 1.0 -->
<fo:block-container position="absolute" top="183pt" left="569pt"
height="343.0pt" width="23.0pt" >
<fo:block>
.
.
.
<fo:block-container position="absolute" top="578pt" left="5pt"
height="25.0pt" width="565.0pt" >
<fo:block >
<xsl:variable
name="filename">../../fundimages/head_top_ten_long.gif</xsl:variable>
<fo:external-graphic src="{$filename}" position="relative"
top="586pt" left="25pt"/>
</fo:block>
</fo:block-container>
<!-- ********** PAGE 2 ************* -->
<fo:block-container break-before="page" position="absolute" top="1pt"
left="392pt" height="225.0pt" width="180.0pt" >
<fo:block >
<xsl:variable name="filename"><xsl:value-of
select="fundimages/stylebox/styleboxdata"/></xsl:variable>
<fo:external-graphic src="{$filename}" position="relative" top="9pt"
left="410pt"/>
</fo:block>
.
.
.
</fo:block-container>
<!-- ********** END PAGE 2 ********* -->
</xsl:template>
</xsl:stylesheet>
template that I hope to use to generate a 2-page PDF file. Each .fo file
uses all absolutely positioned block containers. They are, in fact, the
output from an FO editor (XSLFast).
I tried merging the .fo files and placing a break-before="page" in the 1st
block-container element that came from the second .fo file. Since all the
block-containers are absolutely positioned, this element is not necessarily
the first element that would normally be encountered in the flow.
However, the page break does not work, and I end up with a 1 page PDF with
the contents of both pages overlaid on top of each other.
I've also tried:
* Using break-after="page"
* Nesting the entire contents of the 1st and second pages in a
block-container element, but that did not work either.
How can I get a 2-page PDF from my .fo files?
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE xml [<!ENTITY copy "©"> <!ENTITY trade "™"> <!ENTITY
deg "°"> <!ENTITY gt ">"> <!ENTITY sup2 "²"> <!ENTITY
frac14 "¼"> <!ENTITY quot """> <!ENTITY frac12 "½">
<!ENTITY euro "€"> <!ENTITY Omega "Ω"> ]> <!-- Document
generated with XSLfast v1.3 -->
<xsl:stylesheet xmlns:fox="http://xml.apache.org/fop/extensions"
xmlns:print="http://www.jcatalog.com/com.jcatalog.output.xslextensions.print
.PrintElementFactory" xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://icl.com/saxon" extension-element-prefixes="saxon print"
<xsl:variable name="currentDate" >01-03-2004 10:47:11</xsl:variable>
<xsl:variable name="IMAGEEXT">gif</xsl:variable>
<xsl:template match="xml">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="pagemaster1"
page-height="792.0pt" page-width="612.0pt">
<fo:region-body margin-left="20pt" margin-top="8pt"
margin-bottom="8pt" margin-right="18pt"/>
<fo:region-before extent="8pt"/>
<fo:region-after extent="8pt" />
<fo:region-start extent="20pt" />
<fo:region-end extent="18pt" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="pagemaster1">
<fo:static-content flow-name="xsl-region-before" >
</fo:static-content>
<fo:static-content flow-name="xsl-region-after" >
</fo:static-content>
<fo:static-content flow-name="xsl-region-start" >
</fo:static-content>
<fo:static-content flow-name="xsl-region-end" >
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<xsl:apply-templates/>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="alphafactbookupdate">
<!-- *** Page 1 content *** -->
<fo:block-container position="absolute" top="183pt" left="390pt"
height="343.0pt" width="23.0pt" >
<fo:block>
<fo:instream-foreign-object>
<svg:svg xmlns:svg="http://www.w3.org/2000/svg" width = "8.0"
height="328.0">
<svg:g style="stroke:#b3b9c9; stroke-width:1.0">
<svg:line x1="2.0pt" y1="2.0pt" x2="2.0pt" y2="322.0pt" />
</svg:g>
</svg:svg>
</fo:instream-foreign-object>
</fo:block>
</fo:block-container>
<!-- OFFSET = 1.0 -->
<fo:block-container position="absolute" top="183pt" left="569pt"
height="343.0pt" width="23.0pt" >
<fo:block>
.
.
.
<fo:block-container position="absolute" top="578pt" left="5pt"
height="25.0pt" width="565.0pt" >
<fo:block >
<xsl:variable
name="filename">../../fundimages/head_top_ten_long.gif</xsl:variable>
<fo:external-graphic src="{$filename}" position="relative"
top="586pt" left="25pt"/>
</fo:block>
</fo:block-container>
<!-- ********** PAGE 2 ************* -->
<fo:block-container break-before="page" position="absolute" top="1pt"
left="392pt" height="225.0pt" width="180.0pt" >
<fo:block >
<xsl:variable name="filename"><xsl:value-of
select="fundimages/stylebox/styleboxdata"/></xsl:variable>
<fo:external-graphic src="{$filename}" position="relative" top="9pt"
left="410pt"/>
</fo:block>
.
.
.
</fo:block-container>
<!-- ********** END PAGE 2 ********* -->
</xsl:template>
</xsl:stylesheet>