![]() |
| Previous Top Next |
Working with Tables |
In an SPS, two types of tables are used: SPS tables and XML tables. There are crucial differences between the two types, and it is important to understand these. This section contains a detailed description of SPS tables and XML tables, and instructions about how to use them. For now, we look at the broad picture.
The illustration below shows the relationship of SPS tables and XML tables to the SPS and to the XML document.

SPS tables
An SPS table is a component of an SPS, and is created and formatted using StyleVision. If present in an SPS, an SPS table appears in Authentic View as well as in the XSLT stylesheets you generate with StyleVision.
The structure of an SPS table is specified by the person who designs the SPS. An SPS table can be created anywhere in an SPS, and any number of SPS tables can be created.
SPS tables are entirely presentational devices and are represented using the presentational vocabulary of Authentic View and the output format. The structure of an SPS table is not represented by nodes in the XML document—although the content of table cells may come from nodes in the XML document. SPS tables occur in three types of output:
| • | Rendered in Authentic View; a vocabulary specific to Authentic View is used to mark up SPS tables. |
| • | In StyleVision-generated XSLT stylesheets for HTML output, SPS tables are marked up as HTML tables. |
| • | In StyleVision-generated XSLT stylesheets for RTF output, SPS tables are marked up as RTF tables. |
| • | In StyleVision-generated XSLT stylesheets for XSL-FO output, SPS tables are marked up as XSL-FO tables. |
| • | In StyleVision-generated XSLT stylesheets for Word 2007 output, SPS tables are marked up as Word 2007 tables. |
There are two types of SPS tables:
| • | Static tables are built up, step-by-step, by the person designing the SPS. After the table structure is created, the content of each cell is defined separately. The content of cells can come from random locations in the schema tree and even can be of different types. It is important to realize that the rows of a static table are not intended to represent a repeating data structure. This is why the table is said to be static: it has a fixed structure that does not change with the XML content. |
| • | Dynamic tables are intended for data structures in the XML document that repeat. They can be created for schema elements that have a substructure—that is, at least one child attribute or element. Any element with a substructure repeats if there is more than one instance of it. Each instance of the element would be a row in the dynamic table, and all or some of its child elements or attributes would be the columns of the table. A dynamic table's structure, therefore, reflects the content of the XML file and changes dynamically with the content. |
XML tables
An XML table is created by the Authentic View user as a data structure in the XML document. The purpose of XML tables is to give the Authentic View user the option of inserting a table-type data structure in the XML document. This XML data structure can then be transformed to the table markup of the output format.
The data structure for an XML table must correspond to either the HTML or CALS table model. One element in the XML document corresponds to the table element of the CALS or HTML table model, and must have a substructure that corresponds to either the CALS or HTML table model. An XML table can be inserted at any point in the XML document where it is allowed according to the schema. An XML table is formatted after it is inserted in the XML document.
Shown below is the Authentic View of an XML table that corresponds to the HTML table model.

Data that is entered into the table's cells is entered as content of the corresponding XML elements. For example, the HTML text fragment for the XML table shown in the illustration above looks like this:
<table border="1" width="40%">
<tbody>
<tr>
<td>Name</td>
<td>Phone</td>
</tr>
<tr>
<td>John Merrimack</td>
<td>6517890</td>
</tr>
<tr>
<td>Joe Concord</td>
<td>6402387</td>
</tr>
</tbody>
</table>
The original XML document might look like this:
<phonelist border="1" width="40%">
<items>
<person>
<name>Name</name>
<phone>Phone</phone>
</person>
<person>
<name>John Merrimack</name>
<phone>6517890</phone>
</person>
<person>
<name>Joe Concord</name>
<phone>6402387</phone>
</person>
</items>
</phonelist>
Note that the element names in the XML document have no relation to table terminology; the table structure, however, corresponds to the HTML table model (it could also correspond to the CALS table model in order to be allowed as an XML table). Also note the following:
| • | An XML table can be inserted at any location in the XML document where, according to the schema, a table is allowed. |
| • | In Authentic View, data is entered directly into table cells. This data is stored as the content of the corresponding XML table element. |
| • | The formatting properties of an XML table are assigned in Authentic View. |
Note that XSLT stylesheets generated with StyleVision will not contain XML tables—because no template for the XML table is automatically included in the SPS.
Summary for designer
From the document designer's perspective, the following points should be noted:
| • | An SPS table occurs in the XML document at a location determined by the designer of the document—not the user of Authentic View. The structure and formatting of SPS tables are specified by the designer of the SPS in StyleVision. |
| • | The location, structure, and formatting of XML tables are specified by the user of Authentic View. The user may insert an XML table wherever this is allowed by the schema (remember: the table element corresponds to an element in the schema). Note also that the table format of XML tables is available only in Authentic View. The HTML, RTF, PDF, and Word 2007 output will not automatically display a table format. You will have to create your own template/s to match the table element, and manually add these to the generated XSLT stylesheets. |
See also:
Creating Static Tables, for a description of how to use static tables.
Creating Dynamic Tables, for a description of how to use dynamic tables.
XML Tables, for a description of how to work with table structures that are defined in the XML document.
|