In an SPS design, two types of tables may be used: SPS tables and CALS/HTML tables. There are differences between the two types, and it is important to understand these. This section contains a detailed description of how to use both types of tables.
An SPS table is a component of an SPS design. It is structured and formatted in the design. It can be created anywhere in the design 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.
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. Note that the rows of a static table do not 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.
The content model of a CALS table or HTML table is defined in the XML document—by extension in the DTD or schema—and follows the respective specification (CALS or HTML). In the SPS design you can then specify that CALS/HTML table/s are to be processed as tables. The XML data structure that represents the CALS/HTML table will in these cases generate table markup for the respective output formats. The formatting of CALS/HTML tables can be specified in the XML instance document or the SPS, or in both.
Shown below is the HTML Preview of an HTML table.
The HTML code fragment for the XML table shown in the illustration above looks like this:
<table border="1" width="40%">
The original XML document might look like this:
<phonelist border="1" width="40%">
Note that element names in the XML document do not need to have table semantics; the table structure, however, must correspond to the HTML or CALS table model. Also note the following:
•Note that only one XML element can correspond to the HTML column element <td/>.
•A CALS/HTML table can be inserted at any location in the XML document where, according to the schema, the element corresponding to the table element is allowed.
•In Authentic View, data is entered directly into table cells. This data is stored as the content of the corresponding CALS/HTML table element.
•The formatting properties of a CALS/HTML table could come from the XML document, or they could be specified in the SPS design.
From the document designer's perspective, the following points should be noted:
•The structure of an SPS table is defined in the SPS. The structure of a CALS/HTML table on the other hand is specified in the schema and must follow that of the CALS/HTML table model; the element names in the schema may, however, be different than those in the CALS or HTML table models.
•Colspans and rowspans in SPS tables are specified in the SPS. But in CALS/HTML tables, colspans and rowspans are specified in the XML instance document.
•Table formatting of SPS tables is specified in the SPS. The formatting of CALS/HTML tables is specified in the XML instance document and/or the SPS.