ELSGestion / els-sie-xsl-lib

A set of XSL libraries
5 stars 1 forks source link

HTML2CALS: add colname attribute on entries #15

Closed mricaud closed 4 years ago

mricaud commented 4 years ago

colname attribute is never setted on entries in html2cals.xsl (only namest and nameend attributes are setted when cells a merged)

This doesn't make the table unvalid and we can get the col specification by counting positions (while processing cals2html.xsl for instance)

But it would be an enhancement to have those colname attributes on entries, to make the cals table easier to read and even parsing by any program.

mricaud commented 4 years ago

It seems quite easy to do by replacing line 921:

<xsl:if test="@xhtml2cals:colspan > 1">
  <xsl:attribute name="namest" select="concat('c', count(preceding-sibling::*) + 1)"/>
  <xsl:attribute name="nameend" select="concat('c', count(preceding-sibling::*) + @xhtml2cals:colspan)"/>
</xsl:if>

by:

<xsl:choose>
  <xsl:when test="@xhtml2cals:colspan > 1">
    <xsl:attribute name="namest" select="concat('c', count(preceding-sibling::*) + 1)"/>
    <xsl:attribute name="nameend" select="concat('c', count(preceding-sibling::*) + @xhtml2cals:colspan)"/>            
  </xsl:when>
  <xsl:otherwise>
    <xsl:attribute name="colname" select="concat('c', count(preceding-sibling::*) + 1)"/>
  </xsl:otherwise>
</xsl:choose>

But we have to be carefull that the colspec with this name exists in the final cals table