<?tei:SOF p2fttab.odd ?>
<!-- $Id: p2fttab.odd,v 1.3 1994/03/07 15:31:52 lou Exp $ -->
<!-- $Log: p2fttab.odd,v $
# Revision 1.3  1994/03/07  15:31:52  lou
# apply various typos etc.
#
# Revision 1.2  1994/03/01  03:56:59  msmcq
# revision during/after SC meeting
# -->
<!-- Revisions:                                               -->
<!-- 1994-02-23 : MSM : cleanup for TEI P3                    -->
 
<div2 id=FTTAB><head>Tables</head>
 
<p>A table is the least <soCalled>graphic</soCalled> of the elements
discussed in this chapter.  Almost any text structure can be presented
as a series of rows and columns:  one might, for example, choose to show
a glossary or other form of list in tabular form, without necessarily
regarding it as a table.  In such cases, the global <att>rend</att>
attribute is an appropriate way of indicating that some element is being
presented in tabular format.  When tabular presentation is regarded as
of less intrinsic importance, it is correspondingly simpler to encode
descriptive or functional information about the contents of the table,
for example to identify one column as containing names and another as
containing dates, though the two methods may be combined.
 
<p>When, however, particular SGML elements are required to encode the
tabular arrangement itself, then one or other of the various
<soCalled>table DTDs</soCalled> now available may be preferable.  The
table DTDs in common use generally view a table as a special text
element, made up of row elements (or, sometimes, column elements),
themselves composed of cells.  Table cells generally appear in row-major
order, with the first row from left to right, then the second row, and
so on.  Details of appearance such as column widths, border lines, and
alignment are generally encoded by numerous attributes.  Beyond this,
however, such DTDs differ greatly.  This section begins by describing a
table DTD of this kind; a brief summary of some other widely available
table DTDs is also provided in section <xref target=FTTAB2>.
 
<div3 id=FTTAB1><head>The TEI Table DTD</head>
 
<p>For encoding tables of low to moderate complexity, these Guidelines
provide the following special purpose elements:
 
<tagList>
<tagDesc tagDoc=TABLE atts='rows cols'>
<tagDesc tagDoc=ROW atts='role'>
<tagDesc tagDoc=CELL atts='role cols rows'>
</tagList>
 
<p>The <gi>table</gi> element is defined as a member of the class
<term>inter</term>; it may therefore appear both within other components
(such as paragraphs), or between them, provided that the additional tag
set defined in this chapter has been enabled, as described at the
beginning of this chapter.
 
<p>It is to a large extent arbitrary whether a table should be regarded
as a series of rows or as a series of columns.  For compatibility with
currently available systems, however, these Guidelines require a
row-by-row description of a table.  It is also possible to describe a
table simply as a series of cells; this may be useful for tabular
material which is not presented as a simple matrix.
 
<p>The attributes <att>rows</att> and <att>cols</att> may be used to
indicate the size of a table, or to indicate that a particular cell of a
table spans more than one row or column.  For both tables and cells,
rows and columns are always given in top-to-bottom, left-to-right order.
These Guidelines do not require that the size of a table be specified;
for most formatting and many other applications, it will be necessary to
process the whole table in two passes in any case.
 
<p>Where cells span more than one column or row, the encoder must
determine whether this is a purely presentational effect (in which case
the <att>rend</att> attribute may be more appropriate), whether the part
of the table affected would be better treated as a nested table, or
whether to use the spanning attributes listed above.
 
<p>The <att>role</att> attribute may be used to categorize a single
cell, or set a default for all the cells in a given row.  The present
Guidelines distinguish the roles of <term>label</term> and
<term>data</term> only, but the encoder may define other roles, such as
<q>derived</q>, <q>numeric</q>, etc., as appropriate.
 
<p>The following simple example demonstrates how the data presented as a
labelled list in section <xref target=COLI> might be represented by an
encoder wishing to preserve its original appearance as a table:
 
<eg>
<![ CDATA [
<table rows=2 cols=2 rend=boxed>
<head rend=it>Report of the conduct and progress
of Ernest Pontifex.  Upper Vth form &mdash; half
term ending Midsummer 1851</head>
<row><cell role=label>Classics</cell>
     <cell>Idle listless and unimproving</cell>
</row>
<row><cell role=label>Mathematics</cell>
     <cell>ditto</cell>
</row>
<row><cell role=label>Divinity</cell>
     <cell>ditto</cell>
</row>
<row><cell role=label>Conduct in house</cell>
      <cell>Orderly</cell>
</row>
<row><cell role=label>General conduct</cell>
     <cell>Not satisfactory, on account of his great
     unpunctuality and inattention to duties</cell>
</row></table>
]]>
</eg><!-- S Butler, Way of all Flesh, -->
 
<p>Note that this encoding makes no attempt to represent the full
significance of the <q>ditto</q> cells above; these might be regarded as
simple links between the cells containing them and that to which they
refer, or as virtual copies of it.  For ways of representing either
interpretation, see chapter <xref target=SA>.
 
<p>The following example demonstrates how a simple statistical table may
be represented using this scheme:
 
<eg>
<![ CDATA [
<table rows=4 cols=4>
<head>Poor Man's Lodgings in Norfolk (Mayhew, 1843)
<row role=label>
  <cell>
  <cell>Dossing Cribs or Lodging Houses
  <cell>Beds
  <cell>Needys or Nightly Lodgers
<row role=data>
  <cell role=label>Bury St Edmund's
  <cell>5<cell>8<cell>128
<row role=data>
  <cell role=label>Thetford
  <cell>3<cell>6<cell>36
<row role=data>
  <cell role=label>Attleboro'
  <cell>3<cell>5<cell>20
<row role=data>
  <cell role=label>Wymondham
  <cell>1<cell>11<cell>22
<!-- ... -->
</table>
]]>
</eg>
 
<p>Note the use of a blank cell in the first row to ensure that the
column labels are correctly aligned with the data.  Again, this encoding
does not explicitly represent the alignment between column and row
labels and the data to which they apply.  Where the primary emphasis of
an encoding is on the semantic content of a table, a more explicit
mechanism for the representation of structured information such as that
provided by the feature structure mechanism described in chapter <xref
target=FS> may be preferred.  Alternatively, the general purpose linkage
and alignment mechanisms described in chapter <xref target=SA> may also
be applied to individual cells of a table.
 
<p>The content of a table cell need not be simply character data.  It
may also contain any sequence of the phrase level elements described in
chapter <xref target=CO>, thus allowing for the encoding of potentially
more useful semantic information, as in the following example, where the
fact that one cell contains a number and the other contains a place name
has been explicitly recorded:
 
<eg>
<![ CDATA [
<table>
   <head>US State populations, 1990</head>
   <row role=data>
        <cell><name>Wyoming</>
        <cell><num>453,588</></row>
   <row><cell><name>Alaska</>
        <cell><num>550,043</></row>
   <row><cell><name>Vermont</>
        <cell><num>562,758</></row>
   <row><cell><name>District of Columbia</>
        <cell><num>606,900</></row>
   <row><cell><name>North Dakota</>
        <cell><num>638,800</></row>
   <row><cell><name>Delaware</>
        <cell><num>666,168</></row>
   <row><cell><name>South Dakota</>
        <cell><num>696,004</></row>
   <row><cell><name>Montana</>
        <cell><num>799,065</></row>
   <row><cell><name>Rhode Island</>
        <cell><num>1,003,464</></row>
  <!-- ... -->
</table>
]]>
</eg>
 
<p>In syntactic terms this is little more than a name-change; however,
the new names are more useful in that they convey something about the
nature and significance of the information, rather than merely
suggesting how to display it in rows and columns.</p>
 
<p>The TEI table elements are defined as follows:
<dtdFrag id=DFTTAB n='Tables'>
<tagDecl tagDoc=TABLE>
<tagDecl tagDoc=ROW>
<tagDecl tagDoc=CELL>
</dtdFrag>
 
<div3 id=FTTAB2><head>Other Table DTDs</head>
 
<p>Many SGML authoring systems now include built-in support for their
own or for public table DTDs.  These often provide an enhanced user
interface and good formatting capabilities, but are often
product-specific, despite their use of SGML.
 
<p>The SGML DTD developed by the Association of American Publishers
(AAP) and standardized in ANSI Z39.59 provided a very simple encoding
for correspondingly simple tables.  This has been further developed,
together with the table DTD documented in ISO Technical Report 9537, and
now forms part of ISO 12083.  The TEI DTD fragment described above has
functionality very similar to that defined by ISO 12083.
 
<!-- need proper bibliog refs for these -->
 
<p>For more complex tables, the most effective publically-available DTD
is probably that developed by the US Department of Defense CALS project.
This supports vertical and horizontal spanning and various kinds of text
rotation and justification within cells and is also directly supported
by a number of existing SGML software systems.
 
<p>The CALS table DTD is much too complex to describe fully here;
information on it can be obtained, among other places, from the Graphic
Communications Association in Alexandria, Virginia.  The formal name of
the CALS SGML requirements is MIL-M-28001A.
 
<!-- need proper biblio reference here -->
 
Tables conforming to the CALS DTD may be incorporated into documents
conforming to these Guidelines, but this may require substantial
modification of the TEI DTD which should not be undertaken without
expert advice.
 
</div2>

<?tei:EOF p2fttab.odd ?>
