Language reference : Base elements : Topic elements : Table elements : table
WebWorks  
table
The <table> element organizes arbitrarily complex relationships of tabular information. This standard table markup allows column or row spanning and table captions or descriptions. An optional title allowed inside the table element provides a caption to describe the table.
The DITA table is based on the OASIS Exchange Table Model, augmented with DITA attributes that enable it for specialization, conref, and other DITA processing. In addition, the table includes a desc element, which enables table description that is parallel with figure description. See simpletable for a simplified table model that can be specialized to represent more regular relationships of data.
In DITA tables, in place of the expanse attribute used by other DITA elements, the pgwide attribute is used in order to conform to the OASIS Exchange Table Model. This attribute has a similar semantic (1=page width; 0=resize to galley or column).
Note: The scale attribute represents a stylistic markup property that is maintained (for now) in tables for legacy purposes. External stylesheets should enable less dependency on this attribute. You should use the scale attribute judiciously in your topics.
Contains
Note: These models represent only the default document types distributed by OASIS. Actual content models will differ with each new document type.
Doctype
Content model
topic, map, concept, ditabase, glossary, glossentry, glossgroup, reference, task, bookmap, classifyMap, subjectScheme, machineryTask, learningAssessment, learningBookmap, learningContent, learningMap, learningOverview, learningPlan, learningSummary
( ( (title) (optional) then (desc) (optional) ) (optional) then (tgroup) (one or more) )
Contained by
Doctype
Content model
topic (base)
map (base), classifyMap, subjectScheme, learningBookmap, learningMap
topic (technical content)
map (technical content), bookmap
concept
ditabase
glossary, glossentry, glossgroup
reference
task (strict), task (general)
machineryTask
learningAssessment, learningOverview, learningSummary
learningContent
learningPlan
Inheritance
- topic/table
Example 72. Example
Source:
<table>
<tgroup cols="2">
<colspec colname="COLSPEC0" colwidth="121*"/>
<colspec colname="COLSPEC1" colwidth="76*"/>
<thead>
<row>
<entry colname="COLSPEC0" valign="top">Animal</entry>
<entry colname="COLSPEC1" valign="top">Gestation</entry>
</row>
</thead>
<tbody>
<row>
<entry>Elephant (African and Asian)</entry>
<entry>19-22 months</entry>
</row>
<row>
<entry>Giraffe</entry>
<entry>15 months</entry>
</row>
<row>
<entry>Rhinoceros</entry>
<entry>14-16 months</entry>
</row>
<row>
<entry>Hippopotamus</entry>
<entry>7 1/2 months</entry>
</row>
</tbody>
</tgroup>
</table>
Formatted output:
Animal
Gestation
Elephant (African and Asian)
19-22 months
Giraffe
15 months
Rhinoceros
14-16 months
Hippopotamus
7 1/2 months
Attributes
Name
Description
Data Type
Default Value
Required?
frame
Specifies which portion of a border should surround the element. Allowable values are:
top
Draw a line before the element
bottom
Draw a line after the element
topbot
Draw a line both before and after the element
all
Draw a box around the element
sides
Draw a line at each side of the element
none
Don't draw any lines around this element
-dita-use-​conref-​target
See Using the -dita-use-conref-target value for more information.
Some DITA processors or output formats may not be able to support all values.
 
(top | bottom | topbot | all | sides | none | -dita-use-​conref-​target)
#IMPLIED
No
colsep
Column separator. A value of 0 indicates no separators; 1 indicates separators.
NMTOKEN
#IMPLIED
No
rowsep
Row separator. A value of 0 indicates no separators; 1 indicates separators.
NMTOKEN
#IMPLIED
No
pgwide
Determines the horizontal placement of the element. Supported values are 1 and 0, although these are not mandated by the DTD or Schema.
For print-oriented display, the value "1" places the element on the left page margin; "0" aligns the element with the left margin of the current text line and takes indention into account.
For XHTML, the table surrounds the table data. Either value sets the table width to 100%.
 
NMTOKEN
#IMPLIED
No
rowheader
This attribute specifies whether the content of the first column in a table contains row headings. In the same way that a column header introduces a table column, the row header introduces the table row. This attribute makes tables whose first column contains row headings more readable on output. Allowable values are:
firstcol
The first column contains the row headings.
norowheader
Indicates that no column contains row headings. This is the processing default.
-dita-use-​conref-​target
See Using the -dita-use-conref-target value for more information.
Note that this attribute is not part of the OASIS Exchange Table model upon which DITA tables are based; because of this, some DITA processors or output formats may not be able to support all values.
 
(firstCol | norowheader| -dita-use-​conref-​target)
#IMPLIED
No
scale
Specifies a percentage, selected from an enumerated list, that is used to resize fonts in relation to the normal text size. This attribute is primarily useful for print-oriented display.
The scale attribute provides an acknowledged style-based property directly on DITA elements. For the table and fig elements, the intent of the property is to allow authors to adjust font sizes on the content of the containing element, primarily for print accomodation. An image in these contexts is to be scaled only by its own direct scale property. If not specifically scaled, such an image is unchanged by the scale property of its parent table or fig.
Some DITA processors or output formats may not be able to support all values.
 
(50 | 60 | 70 | 80 | 90 | 100 | 110 | 120 | 140 | 160 | 180 | 200 | -dita-use-​conref-​target)
#IMPLIED
No
univ-atts attribute group (includes select-atts, id-atts, and localization-atts groups)
A set of related attributes, described in univ-atts attribute group
global-atts attribute group (xtrf, xtrc)
A set of related attributes, described in global-atts attribute group
class, outputclass
Common attributes described in Other common DITA attributes