[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Block (container) - one line at the top and one at the bottom - how to achieve this ?


Subject: Re: [xsl] Block (container) - one line at the top and one at the bottom - how to achieve this ?
From: "G. Ken Holman g.ken.holman@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 20 Jan 2015 14:25:39 -0000

At 2015-01-20 13:45 +0000, Kerry, Richard richard.kerry@xxxxxxxx wrote:
I'm trying to lay out a page which will eventually become a title page for some other documents.

Here you are talking about the page, later you are talking about a block container.


The typical solution I taught for full-page-oriented splitting of lines top and bottom is to use footnotes to grow content from the bottom. One doesn't have to do it that way as you can overlay a block-container on the page and so I'll include that approach for both partial-page-size and full-page-size below.

One feature I want to achieve is a box containing two lines of text, one at the top and one at the bottom.
...
I've been advised that I can do this using display-align="after" in a block-container.

You've been misinformed if this is all that you've been told ... it is only part of the solution.


I can get the bounding box using a block-container, but I only seem to get the two lines together, either at the top or the bottom.

Exactly ... so you need to containers, one for the line at the top and one for the line at the bottom. Fortunately, absolutely-positioned block containers are placed relative to the closest bounding reference area, which can be another block-container.


The description of display-align="after" says "The after-edge of the allocation-rectangle of the last child area is placed coincident with the after-edge of the content-rectangle of the reference-area." It doesn't say anything about the non-last child areas (ie "first line") so I expected these to be at the top of the block-container, with just the last one being at the bottom.

Lines are always stacked adjacent to each other, so nothing need be said about the first line ... it will be adjacently stacked to the last line.


Any suggestions how to get this to work ?

Use nested block containers. The "outer" block container can flow your adjacent lines from the top of the container. The "inner" block container can flow your adjacent lines from the bottom of the container. If both containers have the same dimension and the inner one is placed relative to the outer one, then to the reader they see the effect you want.


The example below when run through Antenna House shows on the first page a block container of specific height and on the second page a block container of full page body height. In both examples there is one line at the top of the container and one line at the bottom of the container.

I hope this helps.

. . . . . . . . Ken

<?xml version="1.0" encoding="US-ASCII"?><!--blockcont-split.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">
      <block>This is a test line before the container</block>
      <!--the outer container can start lines from the top-->
      <block-container block-progression-dimension="5cm" border="solid 1pt">
        <block>Top line of container</block>
        <!--the inner container can start lines from the bottom-->
        <!--the absolute position positions the inner within the outer-->
        <block-container absolute-position="absolute" display-align="after"
                         block-progression-dimension="5cm">
          <block>Bottom line of container</block>
        </block-container>
      </block-container>
      <block>This is a test line after the container</block>
      <block space-before="1em">The next page is full page size.</block>
    </flow>
  </page-sequence>
  <page-sequence master-reference="frame">
    <flow flow-name="frame-body" xmlns="http://www.w3.org/1999/XSL/Format">
      <!--the outer container can start lines from the top-->
      <block-container block-progression-dimension="100%">
        <block>Top line of container</block>
        <!--the inner container can start lines from the bottom-->
        <!--the absolute position positions the inner within the outer-->
        <block-container absolute-position="absolute" display-align="after"
                         block-progression-dimension="100%">
          <block>Bottom line of container</block>
        </block-container>
      </block-container>
    </flow>
  </page-sequence>
</root>


-- 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
Keywords