ELSGestion / els-sie-xsl-lib

A set of XSL libraries
5 stars 1 forks source link

html2cals : col width not correct when rowspan #8

Closed mricaud closed 4 years ago

mricaud commented 4 years ago

Just like issue #6 the column width are not correct when the table has rowspan.

Example:

<table>
  <tbody>
    <tr>
      <th rowspan="2" style="width:15%;">
        <p>h1</p>
      </th>
      <th rowspan="2" style="width:40%;">
        <p>h2</p>
      </th>
      <th colspan="2" style="width:20%;">
        <p>h3</p>
      </th>
      <th rowspan="2" style="width:25%;">
        <p>h4</p>
      </th>
    </tr>
    <tr>
      <th style="width:12%;">
        <p>h5</p>
      </th>
      <th style="width:8%;">
        <p>h6</p>
      </th>
    </tr>
  </tbody>
</table>

This table has 5 columns, we should get this cals colspec :

  <colspec colname="c1" colwidth="15%"/>
  <colspec colname="c2" colwidth="40%"/>
  <colspec colname="c3" colwidth="12%"/>
  <colspec colname="c4" colwidth="8%"/>
  <colspec colname="c5" colwidth="25%"/>

Instead of:

  <colspec colname="c1" colwidth="15%"/>
  <colspec colname="c2" colwidth="8%"/>
  <colspec colname="c3" colwidth="20%"/>
  <colspec colname="c4" colwidth="8%"/>
  <colspec colname="c5" colwidth="25%"/>
mricaud commented 4 years ago

c2 = 8% is the result of xpath max(('40%', '8%', '40%')), looks like a bug in Saxon ? The main problem here is about c3 that should be 12%

mricaud commented 4 years ago

See src/test/samples/tables/table_test-colwith.style.widthInCell.cals.xml first table, we now get:

<colspec colname="c1" colwidth="15%"/>
<colspec colname="c2" colwidth="40%"/>
<colspec colname="c3" colwidth="12%"/>
<colspec colname="c4" colwidth="8%"/>
<colspec colname="c5" colwidth="25%"/>

as expected