Merging Tables

Merging Tables

Merge supports table-aware merge processing for both HTML and CALS table formats. Table-aware processing aligns table rows and cells intelligently rather than treating them as generic XML elements.

Enabling Table Processing

Table processing is enabled via the cal-table-processing or html-table-processing parameters:

Bash
java -jar deltanova-year.x.y.z.jar merge concurrent \
  ancestor ancestor.xml anna anna.xml ben ben.xml result.xml \
  cals-table-processing=true

In the Java API:

Java
ConcurrentMerge merge = new ConcurrentMerge();
merge.getCalsTableConfiguration().setProcessTables(true);

In the configuration file:

XML
<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns="com.deltaxml.merge.rest.config"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="merge-configuration.xsd">
  <concurrentMerge>
    <calsTableConfiguration>
        <processTables>true</processTables>
        <invalidTableBehaviour>compareAsXml</invalidTableBehaviour>
        <warningReportMode>comments</warningReportMode>
        <validationLevel>strict</validationLevel>
      </calsTableConfiguration>
      <htmlTableConfiguration>
        <processTables>true</processTables>
        <invalidTableBehaviour>compareAsXml</invalidTableBehaviour>
        <warningReportMode>comments</warningReportMode>
        <validationLevel>strict</validationLevel>
        <normalizeTable>false</normalizeTable>
      </htmlTableConfiguration>
  </concurrentMerge>
</configuration>

HTML Tables

HTML tables (<table>, <tr>, <td>, <th>) are detected automatically when html-table-processing=true.

CALS Tables

CALS tables (used in DocBook and DITA) are also detected automatically. Additional parameters control CALS table validation:

invalid-table-behaviour

Value

Description

PROPAGATE_UP

Propagate changes to the <tgroup> level

COMPARE_AS_XML

Compare invalid CALS tables as plain XML

FAIL

Throw an exception when invalid CALS tables are encountered

validation-level

Value

Description

RELAXED

Invalidities known to have no effect on processing do not cause bypass

STRICT

All invalidities cause the appropriate processing to be bypassed

warning-report-mode

Value

Description

PROCESSING_INSTRUCTIONS

Report warnings as <?dxml_warn ... ?> processing instructions

COMMENTS

Report warnings as XML comments

MESSAGE

Report warnings using <xsl:message/>

Example

Given ancestor.xml:

XML
<table>
  <tr><td>Name</td><td>Value</td></tr>
  <tr><td>Alpha</td><td>1</td></tr>
</table>

Anna adds a row, Ben modifies a value. With html-table-processing=true, the merge output correctly identifies the row addition and cell modification as separate changes rather than conflating them.