PDF视图中缺少CALS表边框线(XSLT)

时间:2018-05-25 12:41:11

标签: xml xslt xsd xsl-fo

这是我的示例CALS表XML结构。

<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>

但PDF视图中缺少边框线。如何在XSLT中处理“rowsep”,“colsep”变量。我设置的帧值是none。 enter image description here

但我需要输出enter image description here

我是xslt写作的新手。请帮我如何使用XSLT归档我的要求。我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

您必须指定一个边框,在这种情况下,每个<entry>

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

FO tablesborder styles

对于@colsep和@rowsep属性,您必须使边界成为条件:

<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>