Again matching table construction in HTML closely, you place data in a tables individual cells with the <fo:table-cell> element. Note that to specify the font and other characteristics of that content, you can enclose an <fo:block> element inside each <fo:table-cell> element. If you wish, you can connect a table cell with a particular table column using the column-number property, or even make a cell span multiple rows and columns , as in HTML tables.
You can use the following XSL-FO properties with the <fo:table-cell> element:
Common accessibility properties: source-document, role
Common aural properties: azimuth, cue-after, cue-before, elevation, pause-after, pause-before, pitch, pitch-range, play-during, richness, speak, speak-header, speak-numeral, speak-punctuation, speech-rate, stress, voice-family, volume
Common border, padding, and background properties: background-attachment , background- color , background-image, background-repeat , background-position-horizontal, background-position-vertical, border-before-color, border-before-style, border-before-width, border-after-color, border-after-style, border-after-width, border-start-color, border-start-style, border-start-width, border-end-color, border-end-style, border-end-width, border-top-color, border-top-style, border-top-width, border-bottom-color, border-bottom-style, border-bottom-width, border-left-color, border-left-style, border-left-width, border-right-color, border-right-style, border-right-width, padding-before, padding-after, padding-start, padding-end, padding-top, padding-bottom, padding-left, padding-right
block-progression-dimension
column-number
display-align
relative-align
empty-cells
ends-row
height
id
number-columns- spanned
number-rows-spanned
relative-position
starts-row
width
In tables.fo, I put both the labels for each column and table data in table cells this way:
<fo:table> <fo:table-column column-width="30mm"/> <fo:table-column column-width="30mm"/> <fo:table-column column-width="30mm"/> <fo:table-column column-width="30mm"/> <fo:table-column column-width="30mm"/> <fo:table-column column-width="30mm"/> <fo:table-body> <fo:table-row> <fo:table-cell border-width="0.5mm"> <fo:block font-weight="bold" font-size="18pt"> Name </fo:block> </fo:table-cell> <fo:table-cell border-width="0.5mm"> <fo:block font-weight="bold" font-size="18pt"> </fo:block> Mass </fo:table-cell> <fo:table-cell border-width="0.5mm"> <fo:block font-weight="bold" font-size="18pt"> Day </fo:block> </fo:table-cell> <fo:table-cell border-width="0.5mm"> <fo:block font-weight="bold" font-size="18pt"> Radius </fo:block> </fo:table-cell> <fo:table-cell border-width='0.5mm"> <fo:block font-weight="bold" font-size="18pt"> Density </fo:block> </fo:table-cell> <fo:table-cell border-width="0.5mm"> <fo:block font-weight="bold" font-size="18pt"> Distance </fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell border-width="0.5mm"> <fo:block font-size="18pt">Mercury</fo:block> </fo:table-cell> <fo:table-cell border-width="0.5mm"> <fo:block font-size="18pt">.0553</fo:block> </fo:table-cell> <fo:table-cell border-width="0.5mm"> <fo:block font-size="18pt">58.65</fo:block> </fo:table-cell> <fo:table-cell border-width="0.5mm"> <fo:block font-size="18pt">1516</fo:block> </fo:table-cell> <fo:table-cell border-width="0.5mm"> <fo:block font-size="18pt">.983</fo:block> </fo:table-cell> <fo:table-cell border-width="0.5mm"> <fo:block font-size="18pt">43.4</fo:block> </fo:table-cell> </fo:table-row> . . . </fo:table-body> </fo:table>
And thats itthe result appears in Figure 11.2, where you see the fully formatted table as created by the fop processor. Now youve learned to create tables with XSL formatting objects.
Theres a lot more to XSL-FO, of course. The next chapter takes a look at working with lists, positioning, columns, page sequences, and more.