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 Theresa Jayne Forster <th...@inbrand.co.uk> on 2011/05/24 13:55:28 UTC

how to do relative position

I am trying to do a multi section document where I have a "container" with
absolute position and then the contents of the "container" are generated
from a template call in the xsl to the same bit of code but with different
contents, I have tried to use position="relative" but it doesn't seem to do
as I would expect it to.

Position="absolute" width="91mm" height="105mm"


Position=relative top=0mm left=0mm


 

 

 

 

What am I doing wrong?

The inner container has inner containers and inner blocks.

This is in a static-content region-after

 

 

Kindest regards

 


Theresa Forster

Senior Software Developer




 


Re: how to do relative position

Posted by Pascal Sancho <pa...@takoma.fr>.
Hi,

2 options for the absolute-position property can be usefull to place an
area:
 - absolute: offsets with respect to nearest ancestor reference area
(block-container is one)
 - fixed: fixes with respect to the page (in case of pagined medium).

Try this:

<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:layout-master-set>
    <fo:simple-page-master master-name="master">
      <fo:region-body margin="2in"/>
    </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="master">
    <fo:flow flow-name="xsl-region-body">
      <fo:block-container absolute-position="absolute" border="solid red
1pt"
          left="-1in" height="100%">
        <fo:block-container absolute-position="absolute"
background-color="#fdd"
            width="1in" height="1in">
          <fo:block/>
        </fo:block-container>
        <fo:block-container absolute-position="fixed"
background-color="#dfd"
            width="1in" height="1in">
          <fo:block/>
        </fo:block-container>
      </fo:block-container>
    </fo:flow>
  </fo:page-sequence>
</fo:root>

Le 27/05/2011 12:04, Theresa Jayne Forster a écrit :
> I got it actually, I mis understood the meaning of absolute and relative, 
> 
> I thought absolute meant always absolute per the document not per the
> containing container....
> 
> Well a day where you learn nothing is a day wasted....
> 
> 
> Kindest regards
> 
> 
> Theresa Forster
> Senior Software Developer

-- 
Pascal

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


RE: how to do relative position

Posted by Theresa Jayne Forster <th...@inbrand.co.uk>.
I got it actually, I mis understood the meaning of absolute and relative, 

I thought absolute meant always absolute per the document not per the
containing container....

Well a day where you learn nothing is a day wasted....


Kindest regards


Theresa Forster
Senior Software Developer



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


Re: how to do relative position

Posted by "Andreas L. Delmelle" <an...@telenet.be>.
On 24 May 2011, at 19:39, Andreas L. Delmelle wrote:

> On 24 May 2011, at 13:55, Theresa Jayne Forster wrote:
>> I am trying to do a multi section document where I have a “container” with absolute position and then the contents of the “container” are generated from a template call in the xsl to the same bit of code but with different contents, I have tried to use position=”relative” but it doesn’t seem to do as I would expect it to…
>> <snip />
> 
> If you use position="absolute" on the inner container as well, it should work as you expect, IIUC (?)
> In that case, the (0,0) coordinate for the inner container is then determined relative(!) to the containing reference area, which is that of the outer container.

I suddenly realized this may have come across as confusing, so just thought I'd provide some further background on this:
The "position" property is actually a shorthand, included in XSL-FO mainly for CSS compatibility. It maps to the native "absolute-position" and "relative-position" properties. 
(http://www.w3.org/TR/xsl/#absolute-position and #relative-position)

One is implemented in FOP, the other is not, yet.
(http://xmlgraphics.apache.org/fop/compliance.html)

However, as pointed out, I believe you can solve your problem with absolute-position only, which _is_ supported. That is, unless I misunderstood your question (?)
If the inner container is a child of the outer container, then relative-position would have virtually the same effect as absolute (except if there is content in the outer container, that  follows the inner container *and* should be normally stacked...)

The biggest difference between the two, is that block-containers with relative position remain part of the normal flow. They are only offset by the specified amounts during rendering. Their accumulated height still influences the layout of the following objects. 
Absolute-positioned containers, OTOH, are 'pulled' out of the flow, so to speak. The layout for the object after that container would just continue on the next line (= right after the content of the preceding sibling of the container).

Also, just to manage expectations, note that an absolute-positioned container's content does not flow from one page to the next. Rather, the overflow, if any, will be handled in accordance with the 'overflow' property.
From the Rec.:
"The following additional restrictions apply for paged presentations:
   * Only objects with absolute-position="auto" may have page/column breaks."
   * For other values any keep and break properties are ignored."



Regards

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


Re: how to do relative position

Posted by "Andreas L. Delmelle" <an...@telenet.be>.
On 24 May 2011, at 13:55, Theresa Jayne Forster wrote:

Hi Theresa

> I am trying to do a multi section document where I have a “container” with absolute position and then the contents of the “container” are generated from a template call in the xsl to the same bit of code but with different contents, I have tried to use position=”relative” but it doesn’t seem to do as I would expect it to…
> <snip />

If you use position="absolute" on the inner container as well, it should work as you expect, IIUC (?)
In that case, the (0,0) coordinate for the inner container is then determined relative(!) to the containing reference area, which is that of the outer container.


Hope this helps!

Regards

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