3. CALS tables
Prev | Chapter 4. Using HTML4 tables or CALS tables in your own custom schema | Next

## 3. CALS tables

Procedure 4.3. Procedure

1. The corresponding support code is contained in ``XXE_install_dir`/doc/configure/jars/cals_table.jar`. In theory, you need to copy this file to the directory containing your custom configuration.

   Now, XXE is bundled with a configuration for DocBook and this configuration includes `docbook.jar`. File `docbook.jar` already contains all the code needed to support CALS tables in XXE. Therefore, unless you have deleted the standard DocBook configuration for XXE, you don't need to copy `cals_table.jar` to the directory containing your custom configuration.

2. Add this snippet at the top of your CSS style sheet:

       @import url(xxe-config:docbook/css/cals_table.imp);

   If you use a namespace (e.g. `http://acme.com/ns`) for all the elements defined in your schema, including for table elements, add this snippet instead. This is not strictly needed but this will speed up the rendering of XML elements on screen:

       @namespace "http://acme.com/ns";
       @import url(xxe-config:docbook/css/cals_table.imp);

3. Add this snippet in your custom configuration for XXE. In the example below, you have chosen to prefix all the custom commands declared in your configuration using prefix "`my.`".

         <command name="my.tableEdit">
           <class>com.xmlmind.xmleditapp.docbook.table.CALSTableEdit</class>
         </command>

   After that, you can reference the above table commands in your custom menu, custom tool bar or custom bindings. Example:

         <menu label="M_yDoc">
           <item label="Insert Column _Before"
                 icon="xxe-config:common/icons/ColumnInsertBefore16.gif"
                 command="my.tableEdit" parameter="insertColumnBefore"/>
           ...

4. File `cals_table.jar` (and also `docbook.jar`) also contains a document hook which ensures that the `cols` attribute of elements `tgroup` and `entrytbl` is always set to a correct value before a DocBook document is validated, saved to disk or converted to another format.

   Using commands `tableColumn` and `tableRow` also ensures that the `cols` attribute is up to date. However it is strongly recommended to add this document hook to your custom configuration. This is done by adding this snippet:

         <documentHook name="cols_checker">
           <class>com.xmlmind.xmleditapp.docbook.table.DocumentHookImpl</class>
         </documentHook>

Prev | Up | Next
2. HTML4 form elements | Home | 3.1. CALS table editor command