xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Magnus Sjöberg <magnus.sjob...@secode.com>
Subject Re: region's content invading neighbor region?
Date Tue, 03 Sep 2002 08:04:27 GMT
You could argue that laying out content using fo is somewhat
complicated for a beginner, I know it took me a while.
First off, read through the spec, around this point:
That should give you some clues to what is happening. There
are some good pictures showing how the layout works.

What you need in your xsl below are margins for your
The margin-x attributes for your simple-page-master defines
the content rectangle of the page-reference area, with
respect to your page-height and page-width.
Inside this then, the region-body has margin attributes
(top, left, bottom and right), as well as being surrounded
by the Region-before, -after, -start and -end areas.
Since your region-start has an extent of 2 inches and your
region-body has no margin (to the left), they effectively
'start' at the same position to the left, thereby
overlapping each other.
Why? Because the spacing between the region-body (to the
left) and region-start is defined as region-body's
margin-left attribute minus region-start's extent attribute.
This would in your case be a negative value.

So to answer your question, which is by no means dumb,
regions can overlap, by design.
And you can prevent them from overlapping through trimming
the margins and extents and so on.

Try and add a margin-left of 2 inches to your region-body,
that should give you something.


Phillip Rhodes wrote:
> I have defined 2 regions, a region-start and a region-body.
> I am writing content to both regions (yea!!!), but the regions are
> overlapping each other.  I defined an extent of 2 inches for the region
> "region-start", but it seems that this does not reserve the space for this
> region, and the region-body content is overwriting the region-start content.
> I can see the content from both regions.  It's just not where I expect it
> to be.
> Thanks.  Sorry if this is a dumb question.  I tried!
> My questions are?
> Why do regions overlap?  Is this by design?
> How can I prevent one region's content from invading another region's?
> <?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="/">
>         <xsl:apply-templates/>
>     </xsl:template>
>    <xsl:template match="guide">
>      <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
>        <fo:layout-master-set>
>                 <fo:simple-page-master  master-name="US-Letter"
>                      page-height="11in"   page-width="8.5in"
>                      margin-top="0.5in"   margin-bottom="0.5in"
>                      margin-left="0.5in"  margin-right="0.5in">
>                         <fo:region-start  extent="2.0in"/>
>                         <fo:region-body/>
>                 </fo:simple-page-master>
>        </fo:layout-master-set>
>         <xsl:apply-templates/>
>        </fo:root>
>    </xsl:template>
>    <xsl:template match="grouping">
>        <fo:page-sequence master-reference="US-Letter">
>         <fo:static-content flow-name="xsl-region-start">
>          <fo:block text-align="end"
>              font-size="10pt"
>              font-family="serif"
>              line-height="14pt" >
>             <xsl:value-of select="@displayText"/> - p. <fo:page-number/>
>          </fo:block>
>         </fo:static-content>
>         <fo:flow flow-name="xsl-region-body">
>                 <xsl:apply-templates/>
>         </fo:flow>
>        </fo:page-sequence>
>    </xsl:template>
>    <xsl:template match="section[@displayHeader = 'true']">
>            <fo:block><xsl:value-of select="@title"/></fo:block>
>    </xsl:template>
> </xsl:stylesheet>

View raw message