35.2.2.5 Identifying table cells with formats: an example

Suppose your DITA document contains a table with the following structure; Table 35-2 has these characteristics:

Table 35-2 Using paragraph formats to identify table cells (example)

 

Configuration parameters

<< Column-header rows have paragraph format CellHead except top row, which has CellHeadM.

Module

PID

Parameter description

Security

001

Administrator PIN

y

<< Body cells have paragraph format CellBody, except cells in rightmost column, which have CellBodyN.

012

Private key

y

Certificate

002

Authority certificate

n

011

Manager certificate

n

009

Server certificate

y

^^ Paragraph format is CategoryM for body cells in the first column = row headers.

To use paragraph formats to identify body cells according to their row headers and column headers, those header cells that span more than one row or column must contain an element that is assigned a paragraph format different from (or perhaps in addition to) the paragraph format assigned to elements used in ordinary row and column headers:

You could specify the following attributes for Table 35-2:

[Tables]
UseTbHeaderCode=Yes
TableHeaderCols=1
ColIDs=Yes
ColHead=col
ColSpanIDs=Yes
ColSpanHead=span
RowIDs=Yes
RowHead=row
RowSpanIDs=Yes
RowSpanHead=span

Because these settings specify enough information to associate every cell in the table with all applicable row and column headers, there is no need for the Scope attribute. However, using it does no harm, so Scope is included for purposes of illustration:

[HtmlStyles]
CellHead=Scope
CellHeadM=Scope Span
CategoryM=Scope Span
CellBodyN=NoColID
[StyleCellScope]
CellHead=column
CellHeadM=colgroup
CategoryM=rowgroup

Because ColIDs take precedence over RowIDs, the top left cell gets id="col1". The cell to its right is in column 2; the cell below it is in row 2. Table 35-2 looks something like this (omitting display attributes) in DITA2Go-generated HTML:

<table>
<caption><p>Table 35-2: Server configuration</p></caption>
<tr><th id="col1" scope="column" rowspan="2"><p>Module</p></th>
    <th id="span1" scope="colgroup" colspan="3">
        <p>Configuration parameters</p></th></tr>
<tr><th id="col2" scope="column" headers="span1">
        <p>PID</p></th>
    <th id="span2" scope="column" colspan="2">
        <p>Parameter description</p></th></tr>
<tr><th id="span3" scope="rowgroup" headers="col1" rowspan="2">
        <p>Security</p></th>
    <td id="row3" headers="col2 span1 span3"><p>001</p></td>
    <td headers="col2 row3 span1 span2 span3">
        <p>Administrator PIN</p></td>
    <td headers="row3 span1 span2 span3"><p>y</p></td></tr>
<tr><td id="row4" headers="col2 span1 span3"><p>012</p></td>
    <td headers="col2 row4 span1 span2 span3"><p>Private key</p></td>
    <td headers="row4 span1 span2 span3"><p>y</p></td></tr>
<tr><th id="span4" scope="rowgroup" headers="col1" rowspan="3">
        <p>Certificate</p></th>
    <td id="row5" headers="col2 span1 span4"><p>002</p></td>
    <td headers="col2 row5 span1 span2 span4">
        <p>Authority certificate</p></td>
    <td headers="row5 span1 span2 span4"><p>n</p></td></tr>
<tr><td id="row6" headers="col2 span1 span4"><p>011</p></td>
    <td headers="col2 row6 span1 span2 span4">
        <p>Manager certificate</p></td>
    <td headers="row6 span1 span2 span4"><p>n</p></td></tr>
<tr><td id="row7" headers="col2 span1 span4"><p>009</p></td>
    <td headers="col2 row7 span1 span2 span4">
        <p>Server certificate</p></td>
    <td headers="row7 span1 span2 span4"><p>y</p></td></tr>
</table>

Previous Topic:  35.2.2.4 Specifying a different HTML table-cell tag

Next Topic:  35.2.3 Using special paragraphs for table-cell attributes

Parent Topic:  35.2.2 Using paragraph formats for table-cell attributes

Sibling Topics:

35.2.2.1 Choosing how to use paragraph formats for WAI markup

35.2.2.2 Assigning WAI attributes to paragraph formats

35.2.2.3 Assigning values to WAI attributes

35.2.2.4 Specifying a different HTML table-cell tag