[xsl] FO: Scaling and centering content in remaining space

Subject: [xsl] FO: Scaling and centering content in remaining space
From: "Michael Müller-Hillebrand mmh@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 24 Oct 2014 09:52:45 -0000
Hello experts,

a given area of a fixed size has two blocks of content. At the top a region
with background color has a minimum height which may grow if text content is
longer.

In the remaining space below it (whose height is unknown) a graphic shall be
positioned with a number of requirements:

* it should be scaled to the available space, either horizontally or
vertically, whatever limit is reached first, I achieved this using min-width
and min-height set to "100%",
* if limited by max-height it should be centered horizontally, this is easily
done using text-align="center",
* if limited by max-width it should be centered vertically, which I finally
achieved using the spacing attributes shown below.

But it looks not very elegant (to me, that is). Are there better methods to
scale and distribute content in the unknown available space? An answer naming
the concept to look at would be greatly appreciated.

Thanks,

- Michael M|ller-Hillebrand


<fo:block-container position="fixed" top="44mm" height="202mm">
 <fo:block-container background-color="blue" min-height="70mm"
padding-bottom="5mm">
  <fo:block>Text</fo:block>
  <fo:block>Text</fo:block>
  <fo:block>Text</fo:block>
 </fo:block-container>
 <fo:block text-align="center"
     space-before.minimum="1mm" space-before.maximum="40mm"
space-before.optimum="10mm"
     space-before.conditionality="retain"
     space-after.minimum="1mm" space-after.maximum="40mm"
space-after.optimum="10mm"
     space-after.conditionality="retain">
  <fo:external-graphic src="image.png"
     min-height="100%" max-height="100%"
     min-width="100%" max-width="100%" />
 </fo:block>
</fo:block-container>

[demime 1.01d removed an attachment of type application/pgp-signature which had a name of signature.asc]

Current Thread