Search code examples
xmlxsltxsdxsl-fo

CALS table border line missing in PDF view (XSLT)


This is my Sample CALS table XML structure.

<table id="table_Test" frame="none">
  <tgroup cols="7">
    <colspec colname="cgen1"/>
    <colspec colname="c1" colwidth="10*"/>
    <colspec colname="c2" colwidth="10*"/>
    <colspec colname="c3" colwidth="10*"/>
    <colspec colname="c4" colwidth="10*"/>
    <colspec colname="c5" colwidth="10*"/>
    <colspec colname="cgen2"/>
    <thead>
      <row>
        <entry rowsep="0" colsep="0"/>
        <entry colsep="0"/>
        <entry colsep="0"/>
        <entry colsep="0"/>
        <entry colsep="0"/>
        <entry colsep="0"/>
        <entry rowsep="0" morerows="0"/>
      </row>
      <row>
        <entry rowsep="0" colsep="1" morerows="0"/>
        <entry align="center"><para>Test1</para></entry>
        <entry align="center"><para>Test2</para></entry>
        <entry align="center"><para>Test3</para></entry>
        <entry align="center"><para>Test4></entry>
        <entry align="center"><para>Test5</para></entry>
        <entry rowsep="0" morerows="0"/>
      </row>
    </thead>
    <tbody>
      <row>
        <entry rowsep="0" morerows="0"/>
        <entry>
          <para> Test6</para>
        </entry>
        <entry>Test 7</entry>
        <entry>
          <para>Test 8</para>
        </entry>
        <entry>
          <para>Test 9</para>
        </entry>
        <entry>
          <para>Test 10</para>
        </entry>
        <entry rowsep="0" morerows="0"/>
      </row>
      <row>
        <entry rowsep="0" colsep="0" morerows="0"/>
        <entry rowsep="0"/>
        <entry><para>Test 11</para></entry>
        <entry><para>Test 12</para></entry>
        <entry><para>Test 13</para></entry>
        <entry rowsep="0" colsep="0"/>
        <entry rowsep="0" morerows="0"/>
      </row>
      <row>
        <entry rowsep="0" colsep="0" morerows="0"/>
        <entry rowsep="0"/>
        <entry><para>Test 14</para></entry>
        <entry/>
        <entry/>
        <entry rowsep="0" colsep="0"/>
        <entry rowsep="0" morerows="0"/>
      </row>
      <row>
        <entry rowsep="0" colsep="0" morerows="0"/>
        <entry rowsep="0"/>
        <entry><para>Test 15</para></entry>
        <entry/>
        <entry/>
        <entry rowsep="0" colsep="0"/>
        <entry rowsep="0" morerows="0"/>
      </row>
      <row>
        <entry rowsep="0" colsep="0" morerows="0"/>
        <entry rowsep="0" colsep="0"/>
        <entry rowsep="0" colsep="0"/>
        <entry rowsep="0" colsep="0"/>
        <entry rowsep="0" colsep="0"/>
        <entry rowsep="0" colsep="0"/>
        <entry rowsep="0" colsep="0" morerows="0"/>
      </row>
    </tbody>
  </tgroup>
</table>

but border line are missing in PDF view . how to handle the "rowsep", "colsep" variable in XSLT . I have set frame value is none . enter image description here

but I need output like this enter image description here

I am new for xslt writing . please help me how to archive my requirements use XSLT . How can I solve this?


Solution

  • You have to specify that you want a border, in this case on each <entry>:

    fo:table-cell border="1pt solid black"
    

    FO tables and border styles

    For the @colsep and @rowsep attributes you have to make the borders conditional:

    <fo:table-cell>
    <xsl:if test="not(@colsep='0')">
        <xsl:attribute name="border-left">1pt solid black</xsl:attribute>
        <xsl:attribute name="border-right">1pt solid black</xsl:attribute>
    </xsl:if>