Next / Previous / Contents / TCC Help System / NM Tech homepage

4.6. The PDF history report

When the user checks the PDF output box, the generated page will be presented as a PDF file. To implement this option, we first generate the page using the XSL-FO page description language. In addition to the quoted standard, XSL-FO by Dave Pawson (ISBN 0-596-00355-2) is invaluable for finding the right features in this huge feature set.

Here is the overall structure of the XSL-FO output. The general setup is for duplex printing on letter paper.

<root xmlns="http://www.w3.org/1999/XSL/Format">
  <layout-master-set>
    <simple-page-master page-height="11in" page-width="8.5in"
        master-name="odd" margin-top="0.5in" margin-bottom="0.5in" 
        margin-left="1.5in" margin-right="0.5in">
      <region-body margin-top="0.5in" margin-bottom="0in"
          margin-left="0pc" margin-right="0pc"/>
      <region-before region-name="odd-before" extent="3pc"/>
    </simple-page-master>
    <simple-page-master page-height="11in" page-width="8.5in"
        master-name="even" margin-top="0.5in" margin-bottom="0.5in"
        margin-left="0.5in" margin-right="1.5in">
      <region-body margin-top="0.5in" margin-bottom="0in"
          margin-left="0pc" margin-right="0pc"/>
      <region-before region-name="even-before" extent="3pc"/>
    </simple-page-master>
    <page-sequence-master master-name="all">
      <repeatable-page-master-alternatives>
        <conditional-page-master-reference
            master-reference="odd" odd-or-even="odd"/>
        <conditional-page-master-reference
            master-reference="even" odd-or-even="even"/>
      </repeatable-page-master-alternatives>
    </page-sequence-master>
  </layout-master-set>

We do not use footers in this report. In the static-content/block elements for the running heads, the text-align-last="justify" stretches the contents of the header box to the full page width, and the leader element serves to fill the adjacent space. In the odd-page header, the title appears on the left and the folio (page number) on the right; on the even-page header, the sequence is reversed.

  <page-sequence master-reference="all">
    <static-content flow-name="odd-before">
      <block text-align-last="justify" font-size="9pt" font-style="italic"
          font-family="Palatino, Paladino, serif">
        CBC history report
        <leader leader-pattern="space"/>
        <page-number/>
      </block>
    </static-content>
    <static-content flow-name="even-before">
      <block text-align-last="justify" font-size="9pt" font-style="italic"
          font-family="Palatino, Paladino, serif">
        <page-number/>
        <leader leader-pattern="space"/>
        CBC history report
      </block>
    </static-content>
    <flow flow-name="xsl-region-body">
      ...(main content here)...
    </flow>
  </page-sequence>
</root>

The main content comprises two parts: reduced primary index entries for the select circle(s), and the main table, which closely resembles the HTML layout described in Section 4.4, “The detail history report”.

Each primary index entry starts with the circle name and region codes and the center coordinates in {braces}, all boldfaced; followed by the list of years worked in square brackets. Here is a typical entry.

      <block font-size="10pt" font-family="Palatino, Paladino, serif">
        <inline font-size="10pt" font-weight="bold"
            font-family="Palatino, Paladino, serif">
          Carlsbad Caverns N.P. NM {32&#176;10'N 104&#176;30'W}
        </inline>
        [58&#8211;59,61&#8211;66,72&#8211;75,77&#8211;111]
      </block>

The “&#176;” and “&#8211;” characters are the degree (°) and en-dash (–) characters, respectively.

Following these headings is the main table.

Here is the overall structure of the table:

  <table border-collapse='collapse' margin-top='1pc' width='6.5in'
      font-size="10pt" font-family="Palatino, Paladino, serif">
    <table-column/>
    <table-column column-width='3pc'/>
    <table-column column-width='3pc'/>
    <table-column column-width='3pc'/>
    <table-column column-width='3pc'/>
    <table-column column-width='3pc'/>
    <table-column column-width='3pc'/>
    <table-column column-width='3pc'/>
    <table-column column-width='3pc'/>
    <table-column column-width='3pc'/>
    <table-column column-width='3pc'/>
    <table-body border='3pt solid black' background-color='#ddffff'>
      ...
    </table-body>
  </table>

For each kind of bird, there may be any number of rows, and the species name spans the first column of all those rows. As with the HTML design, we thicken the borders between the row heading and detail group, and also every fourth row and column, to form rows and columns into groups to make it easier for the reader to associate column positions in a logical row with the corresponding heading.

Here is a screen shot of an XSL-FO rendering of a segment similar to the “Great Skua” row shown in Section 4.5, “CSS considerations in page design”. We thicken every third column border and every second row border, but the idea is the same.

And here is the XSL-FO that produced it:

    <table-body border='3pt solid black' background-color='#ddffff'>
      <table-row>
        <table-cell number-rows-spanned='3' background-color='#ddffdd'
            border='1.5pt solid black' border-top-width='3pt'
            padding='2pt'>
          <block text-align='left'>Great Skua</block>
        </table-cell>
        <table-cell padding='2pt' border='0.5pt solid black'
            border-top-width='3pt' border-left-width='1.5pt'>
          <block text-align='right'>1</block>
        </table-cell>
        <table-cell padding='2pt' border='0.5pt solid black'
            border-top-width='3pt'>
          <block text-align='right'>2</block>
        </table-cell>
        <table-cell padding='2pt' border='0.5pt solid black'
            border-top-width='3pt'>
          <block text-align='right'>3</block>
        </table-cell>
        <table-cell padding='2pt' border='0.5pt solid black'
            border-top-width='3pt' border-left-width='1.5pt'>
          <block text-align='right'>4</block>
        </table-cell>
        <table-cell padding='2pt' border='0.5pt solid black'
            border-top-width='3pt'>
          <block text-align='right'>5</block>
        </table-cell>
        <table-cell padding='2pt' border='0.5pt solid black'
            border-top-width='3pt'>
          <block text-align='right'>6</block>
        </table-cell>
      </table-row>
      <table-row>
        <table-cell padding='2pt' border='0.5pt solid black'
            border-left='1.5pt solid black'>
          <block text-align='right'>7</block>
        </table-cell>
        <table-cell padding='2pt' border='0.5pt solid black'>
          <block text-align='right'>8</block>
        </table-cell>
        <table-cell padding='2pt' border='0.5pt solid black'>
          <block text-align='right'>9</block>
        </table-cell>
        <table-cell padding='2pt' border='0.5pt solid black'
            border-left='1.5pt solid black'>
          <block text-align='right'>10</block>
        </table-cell>
        <table-cell padding='2pt' border='0.5pt solid black'>
          <block text-align='right'>11</block>
        </table-cell>
        <table-cell padding='2pt' border='0.5pt solid black'>
          <block text-align='right'>12</block>
        </table-cell>
      </table-row>
      <table-row>
        <table-cell padding='2pt' border='0.5pt solid black'
            border-top-width='1.5pt' border-left-width='1.5pt'>
          <block text-align='right'>13</block>
        </table-cell>
        <table-cell padding='2pt' border='0.5pt solid black'
            border-top-width='1.5pt'>
          <block text-align='right'>14</block>
        </table-cell>
        <table-cell padding='2pt' border='0.5pt solid black'
            border-top-width='1.5pt'>
          <block text-align='right'>15</block>
        </table-cell>
        <table-cell padding='2pt' border='0.5pt solid black'
            border-top-width='1.5pt' border-left='1.5pt solid black'>
          <block text-align='right'>16</block>
        </table-cell>
        <table-cell padding='2pt' border='0.5pt solid black'
            border-top-width='1.5pt'>
          <block text-align='right'>17</block>
        </table-cell>
        <table-cell padding='2pt' border='0.5pt solid black'
            border-top-width='1.5pt'>
          <block text-align='right'>18</block>
        </table-cell>
      </table-row>
    </table-body>