You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Eddy De Clercq <Ed...@aiv.kuleuven.ac.be> on 2002/12/11 12:24:42 UTC

orphans and widows within XSL-FO and Cocoon

Hi,

I have 2 questions:
1. I'm testing Cocoon for creating PDF with XSL-FO in order to investigate the orphan and widow control and till now I can't manage to achieve this.
I'm using http://www.w3.org/TR/1998/WD-xsl-19980818 as a reference and I've just adapted the existing simple-page2fo.xsl (see below). I've tried both keep-with-next and widows and orphans, but none of these seem to work.
I'm fairly new to XSL-FO so it could be that I'm doing something wrong. Can you help me out pls?
2. I've also tried http://www.antennahouse.com/XSLsample/fo/sample-keepwith-next_1.fo (which is linked from http://xml.apache.org/cocoon/link/xsl.html) and this seems not to work either. Which versions of XSL-FO can Cocoon handle and where is a good reference for it.

Thanks in advance

Eddy De Clercq

<?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:template match="/">
   <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
   
    <fo:layout-master-set>
     <fo:simple-page-master master-name="page"
                  page-height="297mm" 
                  page-width="210mm"
                  margin-top="10mm" 
                  margin-bottom="20mm" 
                  margin-left="25mm" 
                  margin-right="25mm">
       <fo:region-before extent="30mm"/>
       <fo:region-body margin-top="30mm"/>
       <fo:region-after extent="15mm"/>
     </fo:simple-page-master>

     <fo:page-sequence-master master-name="all">
       <fo:repeatable-page-master-alternatives>
  <fo:conditional-page-master-reference master-name="page" page-position="first"/>
       </fo:repeatable-page-master-alternatives>
     </fo:page-sequence-master>
    </fo:layout-master-set>

    <fo:page-sequence master-name="all">
      <fo:static-content flow-name="xsl-region-after">
 <fo:block text-align="center" 
           font-size="10pt" 
    font-family="serif" 
    line-height="14pt">page <fo:page-number/></fo:block>
      </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="title">
    <fo:block font-size="36pt" space-before.optimum="24pt" text-align="center"><xsl:apply-templates/></fo:block>
  </xsl:template>
  <xsl:template keep-with-next="true" match="paratitle">
    <fo:block font-size="16pt" space-before.optimum="12pt" text-align="left"><xsl:apply-templates/></fo:block>
  </xsl:template>
  <xsl:template match="para">
    <fo:block font-size="12pt" space-before.optimum="12pt" text-align="left"><xsl:apply-templates/></fo:block>
  </xsl:template>
</xsl:stylesheet>

------extPart_000_003E_01C2A110.4811A5E0
Content-Type: text/html;
	charsetso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1126" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I have 2 questions:</FONT></DIV>
<DIV><FONT face=Arial size=2>1. I'm testing Cocoon for creating PDF with XSL-FO 
in order to investigate the orphan and widow control and till now I can't manage 
to achieve this.</FONT></DIV>
<DIV><FONT face=Arial size=2>I'm using <A 
href="http://www.w3.org/TR/1998/WD-xsl-19980818">http://www.w3.org/TR/1998/WD-xsl-19980818</A>&nbsp;as 
a reference and I've just adapted the existing simple-page2fo.xsl (see below). 
I've tried both keep-with-next and widows and orphans, but none of these seem to 
work.</FONT></DIV>
<DIV><FONT face=Arial size=2>I'm fairly new to XSL-FO so it could be that I'm 
doing something wrong. Can you help me out pls?</FONT></DIV>
<DIV><FONT face=Arial size=2>2.&nbsp;I've also tried <A 
href="http://www.antennahouse.com/XSLsample/fo/sample-keepwith-next_1.fo">http://www.antennahouse.com/XSLsample/fo/sample-keepwith-next_1.fo</A>&nbsp;(which 
is linked from <A 
href="http://xml.apache.org/cocoon/link/xsl.html">http://xml.apache.org/cocoon/link/xsl.html</A>) 
and this seems not to work either. Which versions of XSL-FO can Cocoon handle 
and where is a good reference for it.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Thanks in advance</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Eddy De Clercq</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&lt;?xml version="1.0"?&gt;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&lt;xsl:stylesheet version="1.0"<BR>&nbsp; 
xmlns:xsl="<A 
href="http://www.w3.org/1999/XSL/Transform">http://www.w3.org/1999/XSL/Transform</A>"<BR>&nbsp; 
xmlns:fo="<A 
href="http://www.w3.org/1999/XSL/Format">http://www.w3.org/1999/XSL/Format</A>"&gt;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp; &lt;xsl:template 
match="/"&gt;<BR>&nbsp;&nbsp; &lt;fo:root xmlns:fo="<A 
href="http://www.w3.org/1999/XSL/Format">http://www.w3.org/1999/XSL/Format</A>"&gt;<BR>&nbsp;&nbsp; 
<BR>&nbsp;&nbsp;&nbsp; &lt;fo:layout-master-set&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;fo:simple-page-master 
master-name="page"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
page-height="297mm" 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
page-width="210mm"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
margin-top="10mm" 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
margin-bottom="20mm" 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
margin-left="25mm" 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
margin-right="25mm"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;fo:region-before extent="30mm"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;fo:region-body 
margin-top="30mm"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;fo:region-after extent="15mm"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;/fo:simple-page-master&gt;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;fo:page-sequence-master 
master-name="all"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;fo:repeatable-page-master-alternatives&gt;<BR>&nbsp; 
&lt;fo:conditional-page-master-reference master-name="page" 
page-position="first"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;/fo:repeatable-page-master-alternatives&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;/fo:page-sequence-master&gt;<BR>&nbsp;&nbsp;&nbsp; 
&lt;/fo:layout-master-set&gt;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; &lt;fo:page-sequence 
master-name="all"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;fo:static-content 
flow-name="xsl-region-after"&gt;<BR>&nbsp;&lt;fo:block text-align="center" 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
font-size="10pt" <BR>&nbsp;&nbsp;&nbsp; font-family="serif" 
<BR>&nbsp;&nbsp;&nbsp; line-height="14pt"&gt;page 
&lt;fo:page-number/&gt;&lt;/fo:block&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;/fo:static-content&gt; </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;fo:flow 
flow-name="xsl-region-body"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;xsl:apply-templates/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;/fo:flow&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/fo:page-sequence&gt;<BR>&nbsp;&nbsp; 
&lt;/fo:root&gt;<BR>&nbsp; &lt;/xsl:template&gt;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp; &lt;xsl:template 
match="title"&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;fo:block font-size="36pt" 
space-before.optimum="24pt" 
text-align="center"&gt;&lt;xsl:apply-templates/&gt;&lt;/fo:block&gt;<BR>&nbsp; 
&lt;/xsl:template&gt;<BR>&nbsp; &lt;xsl:template keep-with-next="true" 
match="paratitle"&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;fo:block font-size="16pt" 
space-before.optimum="12pt" 
text-align="left"&gt;&lt;xsl:apply-templates/&gt;&lt;/fo:block&gt;<BR>&nbsp; 
&lt;/xsl:template&gt;<BR>&nbsp; &lt;xsl:template 
match="para"&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;fo:block font-size="12pt" 
space-before.optimum="12pt" 
text-align="left"&gt;&lt;xsl:apply-templates/&gt;&lt;/fo:block&gt;<BR>&nbsp; 
&lt;/xsl:template&gt;<BR>&lt;/xsl:stylesheet&gt;<BR></FONT></DIV></BODY></HTML>




Re: orphans and widows within XSL-FO and Cocoon

Posted by Eddy De Clercq <Ed...@aiv.kuleuven.ac.be>.
Hi,

Thanks for the answer. Since there is no release date for implementing this,
are there alternatives for FOP which handle widow/orphans already?

Greetz

Eddy De Clercq
----- Original Message -----
From: "J.Pietschmann" <j3...@yahoo.de>
To: <co...@xml.apache.org>
Sent: Wednesday, December 11, 2002 9:45 PM
Subject: Re: orphans and widows within XSL-FO and Cocoon


> Eddy De Clercq wrote:
> > I'm testing Cocoon for creating PDF with XSL-FO in
> > order to investigate the orphan and widow control and till now I can't
manage
> > to achieve this.
> Its not implemented yet. The issue is adressed in a redesigned
> version, with no target date yet.
>
> > I've tried both keep-with-next
> This works on table rows, with some caveats. If you want to use
> it for ordinary text, put it in a blind table, as mentioned in the
> FOP FAQ.
>
> > Which versions of XSL-FO can Cocoon handle and where is a good
> > reference for it.
> Recent Cocoon versions should be able to handle all FOP versions from
> 0.20.2 on. Just the latest FOP jar into the lib directory. The FOP
> documentation can be downloaded with both the FOP source and binary
> distribution, as well as read online at
>   http://xml.apache.org/fop
>
> > ------Content-Type: text/html; charsetContent-Transfer-Encoding:
> You should not post HTML mail.
> J.Pietschmann
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>
>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: orphans and widows within XSL-FO and Cocoon

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Eddy De Clercq wrote:
> I'm testing Cocoon for creating PDF with XSL-FO in
> order to investigate the orphan and widow control and till now I can't manage
> to achieve this.
Its not implemented yet. The issue is adressed in a redesigned
version, with no target date yet.

> I've tried both keep-with-next 
This works on table rows, with some caveats. If you want to use
it for ordinary text, put it in a blind table, as mentioned in the
FOP FAQ.

> Which versions of XSL-FO can Cocoon handle and where is a good
> reference for it.
Recent Cocoon versions should be able to handle all FOP versions from
0.20.2 on. Just the latest FOP jar into the lib directory. The FOP
documentation can be downloaded with both the FOP source and binary
distribution, as well as read online at
  http://xml.apache.org/fop

> ------Content-Type: text/html; charsetContent-Transfer-Encoding:
You should not post HTML mail.
J.Pietschmann


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>