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

Re: [xsl] XSL-FO: Background text spanned on several table cells


Subject: Re: [xsl] XSL-FO: Background text spanned on several table cells
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 19 Feb 2009 11:17:21 -0500

At 2009-02-19 16:05 +0000, Florent Georges wrote:
  Thanks Ken, that works great for the problem I described.  The
real problem, though, is a bit more complex.

Isn't that always the case! :{)}


The first three
cells (those to put the text on the background) are spanned over
several rows.  And the table cells have borders.  I've adapted
your example to reflect this situation:

    http://www.fgeorges.org/tmp/background-text-ken.fo
    http://www.fgeorges.org/tmp/background-text-ken.pdf

  You can see in the PDF that the height of the cells is not
spanned anymore over the lines.

Only because they have no knowledge in the inner table about spanning going on outside of the table ... but that is algorithmically determinable.


Ideally, what I would like is
something like this (the vertical position of the background
text does not really matter):

http://www.fgeorges.org/tmp/background-text.jpg

  But I don't know how to tell the processor to use all the
available vertical space for the inner table.

By expressing the block-container height in the cells to be the sum of the heights of the rows being spanned. I had to do this in my UN layout key stylesheets: every cell had an explicit block-progression-dimension= property.


As I said, you are limited in your heights by having to expressly calculate what the heights are for cells.

But since you know which rows are being spanned, and (hopefully) which heights are in those rows, it can still be calculated.

I hope the modified example below helps.

. . . . . . . . . . Ken

<?xml version="1.0" encoding="US-ASCII"?><!--florent.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 for Florent</block>
<table table-layout="fixed">
<table-column column-width="1in" number-columns-repeated="5"/>
<table-body>
<table-row block-progression-dimension=".5in" display-align="center">
<table-cell border="0.5pt solid" text-align="center" number-rows-spanned="2"><block>aaa</block></table-cell>
<table-cell border="0.5pt solid" text-align="center" number-rows-spanned="2"><block>bbb</block></table-cell>
<table-cell border="0.5pt solid" text-align="center" number-rows-spanned="2"><block>ccc</block></table-cell>
<table-cell border="0.5pt solid" text-align="center"><block>ddd</block></table-cell>
<table-cell border="0.5pt solid" text-align="center"><block>eee</block></table-cell>
</table-row>
<table-row block-progression-dimension=".5in" display-align="center">
<table-cell border="0.5pt solid" text-align="center"><block>ddd</block></table-cell>
<table-cell border="0.5pt solid" text-align="center"><block>eee</block></table-cell>
</table-row>
<table-row block-progression-dimension=".5in"
display-align="before">
<table-cell number-columns-spanned="3" number-rows-spanned="2">
<block-container absolute-position="absolute" z-index="1"
block-progression-dimension="1in"
text-align="center" display-align="center">
<block font-weight="bold" font-size="40pt" color="#cccccc">
[ Draft ]
</block>
</block-container>
<block-container absolute-position="absolute" z-index="2"
display-align="before">
<table table-layout="fixed"
block-progression-dimension="1in">
<table-column column-width="1in"
number-columns-repeated="3"/>
<table-body>
<table-cell border="0.5pt solid" text-align="center"
display-align="center"
block-progression-dimension="1in">
<block>111</block></table-cell>
<table-cell border="0.5pt solid" text-align="center"
display-align="center"
block-progression-dimension="1in">
<block>222</block></table-cell>
<table-cell border="0.5pt solid" text-align="center"
display-align="center"
block-progression-dimension="1in">
<block>333</block></table-cell>
</table-body>
</table>
</block-container>
</table-cell>
<table-cell border="0.5pt solid" text-align="center"><block>444</block></table-cell>
<table-cell border="0.5pt solid" text-align="center"><block>555</block></table-cell>
</table-row>
<table-row block-progression-dimension=".5in" display-align="center">
<table-cell border="0.5pt solid" text-align="center"><block>555</block></table-cell>
<table-cell border="0.5pt solid" text-align="center"><block>444</block></table-cell>
</table-row>
<table-row block-progression-dimension=".5in"
display-align="center">
<table-cell border="0.5pt solid" text-align="center" number-rows-spanned="2"><block>vvv</block></table-cell>
<table-cell border="0.5pt solid" text-align="center" number-rows-spanned="2"><block>www</block></table-cell>
<table-cell border="0.5pt solid" text-align="center" number-rows-spanned="2"><block>xxx</block></table-cell>
<table-cell border="0.5pt solid" text-align="center"><block>yyy</block></table-cell>
<table-cell border="0.5pt solid" text-align="center"><block>zzz</block></table-cell>
</table-row>
<table-row block-progression-dimension=".5in" display-align="center">
<table-cell border="0.5pt solid" text-align="center"><block>yyy</block></table-cell>
<table-cell border="0.5pt solid" text-align="center"><block>zzz</block></table-cell>
</table-row>
</table-body>
</table>
</flow>
</page-sequence>
</root>





-- Upcoming hands-on XQuery, XSLT, UBL & code list training classes: Brussels, BE 2009-03; Prague, CZ 2009-03, http://www.xmlprague.cz Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal


Current Thread
Keywords