Return to Snippet

Revision: 29357
at July 28, 2010 01:34 by chrisf


Initial Code
<?xml version="1.0"?>
<fo:root writing-mode="lr-tb" hyphenate="true" text-align="justify" role="html:html" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:html="http://www.w3.org/1999/xhtml">
  <fo:layout-master-set>
    <fo:simple-page-master page-width="auto" page-height="auto" master-name="all-pages">
      <fo:region-body margin-top="0.75in" margin-right="0.75in" margin-bottom="0.75in" margin-left="0.75in" column-count="1" column-gap="12pt" />
      <fo:region-before region-name="page-header" extent="0.75in" display-align="before" />
      <fo:region-after region-name="page-footer" extent="0.75in" display-align="after" />
      <fo:region-start extent="0.75in" />
      <fo:region-end extent="0.75in" />
    </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="all-pages">
    <fo:title />
    <fo:static-content flow-name="page-header">
      <fo:block font-size="small" text-align="center" space-before.conditionality="retain" space-before="0.25in" />
    </fo:static-content>
    <fo:static-content flow-name="page-footer">
      <fo:block font-size="small" text-align="center" space-after.conditionality="retain" space-after="0.25in">
        <fo:block space-before="0.67em" space-after="0.67em" border="1px inset" space-before.minimum="0.5em" space-before.optimum="0.67em" space-before.maximum="0.92em" space-after.minimum="0.5em" space-after.optimum="0.67em" space-after.maximum="0.92em" />
        <fo:float float="right">
          <fo:block width="3cm" text-align="right">Page <fo:page-number /> of <fo:page-number-citation ref-id="last-page-marker" /></fo:block>
        </fo:float>
      </fo:block>
    </fo:static-content>
    <fo:flow flow-name="xsl-region-body">
      <fo:block font-size="0.6em" role="html:body">
        
        <fo:block role="html:div" keep-together="always">
          <fo:table-and-caption display-align="center">
            <fo:table border-collapse="collapse" border-spacing="2px" border="1px solid black" role="html:table" id="EndOfLifeBreakdownByComponent" keep-together="always">
              <fo:table-header start-indent="0pt" end-indent="0pt" text-indent="0pt" last-line-end-indent="0pt" text-align="start" text-align-last="relative" role="html:thead">
                <fo:table-cell linefeed-treatment="preserve" wrap-option="wrap" font-weight="bold" text-align="center" border="1px solid black" padding="1px" >
                  <fo:block>Column1</fo:block>
                </fo:table-cell>
                <fo:table-cell linefeed-treatment="preserve" wrap-option="wrap" font-weight="bold" text-align="center" border="1px solid black" padding="1px" >
                  <fo:block>Column2</fo:block>
                </fo:table-cell>
                <fo:table-cell linefeed-treatment="preserve" wrap-option="wrap" font-weight="bold" text-align="center" border="1px solid black" padding="1px" >
                  <fo:block>Column3 
Header</fo:block>
                </fo:table-cell>
                <fo:table-cell linefeed-treatment="preserve" wrap-option="wrap" font-weight="bold" text-align="center" border="1px solid black" padding="1px" >
                  <fo:block>Column4 
header
	is longer
</fo:block>
                </fo:table-cell>
                <fo:table-cell linefeed-treatment="preserve" wrap-option="wrap" font-weight="bold" text-align="center" border="1px solid black" padding="1px" >
                  <fo:block>Column5 
Header
</fo:block>
                </fo:table-cell>
                <fo:table-cell linefeed-treatment="preserve" wrap-option="wrap" font-weight="bold" text-align="center" border="1px solid black" padding="1px" >
                  <fo:block>Column6 
Header 
Header
Header
</fo:block>
                </fo:table-cell>
                <fo:table-cell linefeed-treatment="preserve" wrap-option="wrap" font-weight="bold" text-align="center" border="1px solid black" padding="1px" >
                  <fo:block>Column7 
Donkey
Donkey
Donkey
</fo:block>
                </fo:table-cell>
              </fo:table-header>
              <fo:table-body start-indent="0pt" end-indent="0pt" text-indent="0pt" last-line-end-indent="0pt" text-align="start" text-align-last="relative" role="html:tbody">
                <fo:table-row role="html:tr">
                  <fo:table-cell text-align="center" border="1px solid black" padding="1px"  >
                    <fo:block>This is a fairly long piece of text.</fo:block>
                  </fo:table-cell>
                  <fo:table-cell text-align="center" border="1px solid black" padding="1px"  >
                    <fo:block>This is an even longer piece of text - I don't mind this wrapping</fo:block>
                  </fo:table-cell>
                  <fo:table-cell text-align="center" border="1px solid black" padding="1px"  >
                    <fo:block>N/A</fo:block>
                  </fo:table-cell>
                  <fo:table-cell text-align="center" border="1px solid black" padding="1px"  >
                    <fo:block>N/A</fo:block>
                  </fo:table-cell>
                  <fo:table-cell text-align="center" border="1px solid black" padding="1px"  >
                    <fo:block>0.65</fo:block>
                  </fo:table-cell>
                  <fo:table-cell text-align="center" border="1px solid black" padding="1px"  >
                    <fo:block>N/A</fo:block>
                  </fo:table-cell>
                  <fo:table-cell text-align="center" border="1px solid black" padding="1px"  >
                    <fo:block>N/A</fo:block>
                  </fo:table-cell>
                </fo:table-row>


              </fo:table-body>
              <fo:table-body start-indent="0pt" end-indent="0pt" text-indent="0pt" last-line-end-indent="0pt" text-align="start" text-align-last="relative" role="html:tbody">
                <fo:table-row role="html:tr">
                  <fo:table-cell text-align="center" border="1px solid black" padding="1px" >
                    <fo:block>Total</fo:block>
                  </fo:table-cell>
                  <fo:table-cell text-align="center" border="1px solid black" padding="1px" >
                    <fo:block />
                  </fo:table-cell>
                  <fo:table-cell text-align="center" border="1px solid black" padding="1px" >
                    <fo:block />
                  </fo:table-cell>
                  <fo:table-cell text-align="center" border="1px solid black" padding="1px" >
                    <fo:block />
                  </fo:table-cell>
                  <fo:table-cell text-align="center" border="1px solid black" padding="1px" >
                    <fo:block>8.7</fo:block>
                  </fo:table-cell>
                  <fo:table-cell text-align="center" border="1px solid black" padding="1px" >
                    <fo:block />
                  </fo:table-cell>
                  <fo:table-cell text-align="center" border="1px solid black" padding="1px" >
                    <fo:block>0.0</fo:block>
                  </fo:table-cell>
                </fo:table-row>
              </fo:table-body>
            </fo:table>
          </fo:table-and-caption>
        </fo:block>
                
      </fo:block>
      <fo:block id="last-page-marker" />
    </fo:flow>
  </fo:page-sequence>
</fo:root>

Initial URL


Initial Description
I am trying to get the table to lay itself out so that the column headers wrap in preference to the table cell values.  Any ideas how to achieve this?

Initial Title
XSL-FO to make a table

Initial Tags


Initial Language
XSLT