【发布时间】:2019-09-12 11:55:16
【问题描述】:
我有三列表格输入 xml,所以 tgroup 将是<tgroup cols="3" colsep="0" rowsep="0">
<row>
<entry colname="col1" colsep="0" rowsep="0">Duty</entry>
<entry colname="col2" colsep="0" rowsep="0"></entry>
<entry colname="col3" colsep="0" rowsep="0">Correct</entry>
</row>
<row>
<entry colname="col1" colsep="0" rowsep="0">Dollar</entry>
</row>
我试过的XSL是:
<xsl:template match="row">
<row>
<xsl:apply-templates/>
</row>
</xsl:template>
<xsl:template match="entry">
<entry>
<xsl:apply-templates/>
</entry>
</xsl:template>
我得到的输出是:
<row>
<entry>Duty</entry>
<entry></entry>
<entry>Correct</entry>
</row>
<row>
<entry>Dollar</entry>
</row>
异常输出:
<row>
<entry>Duty</entry>
<entry></entry>
<entry>Correct</entry>
</row>
<row>
<entry>Dollar</entry>
<entry></entry>
<entry></entry>
</row>
因此,我遇到了验证错误,这取决于 tgroup 列号。所以我想根据 tgroup 列号在输出中创建空条目。
【问题讨论】: