Re: [xsl] More free-form layouts - side-by-side

Subject: Re: [xsl] More free-form layouts - side-by-side
From: "G. Ken Holman g.ken.holman@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 22 Jan 2015 11:30:03 -0000
At 2015-01-22 11:06 +0000, Kerry, Richard richard.kerry@xxxxxxxx wrote:
Having sorted out how to get text to appear at top and bottom within a box, my next requirement that I've not been able to work out for myself is how to get things side-by-side.

What I want is something like this :

+-------------------------------------+
|+------------+         +------------+|
||A           |         |B           ||
|+------------+         +------------+|
|                                     |
|                                     |
|+------------+         +------------+|
||C           |         |D           ||
|+------------+         +------------+|
+-------------------------------------+

The following works just fine in Antenna House (list guidelines prevent me from attaching the screen shot) ... it simply uses the principles I described earlier:


<?xml version="1.0" encoding="US-ASCII"?><!--blockcont-split2.fo-->
<root xmlns="http://www.w3.org/1999/XSL/Format";
      font-family="Times" font-size="20pt">

  <layout-master-set>
    <simple-page-master master-name="frame"
                        page-height="297mm" page-width="210mm"
                        margin-top="15mm" margin-bottom="15mm"
                        margin-left="15mm" margin-right="15mm">
      <region-body region-name="frame-body"/>
    </simple-page-master>
  </layout-master-set>

  <page-sequence master-reference="frame">
    <flow flow-name="frame-body" xmlns="http://www.w3.org/1999/XSL/Format";>
      <!--the outer container sets the frame-->
      <block-container block-progression-dimension="100%">
        <block>Top left</block>
        <!--the inner containers are within the frame-->
        <block-container absolute-position="absolute"
                         block-progression-dimension="100%"
                         left="50%">
          <block>Top right</block>
        </block-container>
        <block-container absolute-position="absolute"
                         block-progression-dimension="100%"
                         top="50%">
          <block>Bottom left</block>
        </block-container>
        <block-container absolute-position="absolute"
                         block-progression-dimension="100%"
                         left="50%" top="50%">
          <block>Bottom right</block>
        </block-container>
      </block-container>
    </flow>
  </page-sequence>
</root>

You can choose to constrain further limitations on the four areas and even introduce an embedded block container for the top left if you want to clip any overages. But if you just have one line of text as above, I see them positioned at the top left of the four corners of the box described by the outer container.

So I am assuming I need to get another block-container within the bounding container, to hold B and D.

Yep! See above.


I would assume I need to position (A and C)'s and (B and D)'s block-containers relatively within the outer block-container.

Yep! See above.


However, I can't seem to make that work.

Perhaps there is a problem with your processor.


Is there any document available that gives a good overview explanation the layout control available in FO ? I don't want to have to ask the list every time I find another layout pattern that I haven't met before.

Layout patterns are just the application of the available features. In my own book on XSL-FO I do not take the time to guess what layouts people might want. Rather, I equip the reader with the facilities available and illustrate how they are applied.


Eventually B and D will be images rather than text. I'm assuming that once I've got the blocks and containers working with text I'll be able to put the appropriate image elements in.

Yep!


I hope this helps.

. . . . . . . Ken

--
Check our site for free XML, XSLT, XSL-FO and UBL developer resources |
Free 5-hour lecture:  http://www.CraneSoftwrights.com/links/video.htm |
Crane Softwrights Ltd.             http://www.CraneSoftwrights.com/s/ |
G. Ken Holman                    mailto:gkholman@xxxxxxxxxxxxxxxxxxxx |
Google+ profile:       http://plus.google.com/+GKenHolman-Crane/about |
Legal business disclaimers:     http://www.CraneSoftwrights.com/legal |


--- This email has been checked for viruses by Avast antivirus software. http://www.avast.com

Current Thread