由于更好的Java兼容性,我正在将一些XSLT模板移动到freemarker,但是freemarker似乎在处理空白方面有问题。XML的结果是到处都是空白,如下所示:
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row> <fo:table-cell
> <fo:block >
<fo:inline font-weight="bold"
strip_whitespace=true
但没有效果。它是默认的,所以它可能已经开始工作了。
<xsl:text> example text including padding </xsl:text>
元素。
更新
:下面是freemarker模板的一部分示例,它在其中生成
fo:table-cell
<#macro tableHeaderM tableHeader>
<#list tableHeader.columns as column><@columnM column=column /></#list>
</#macro>
<#macro columnM column>
<fo:table-column column-width="${column.width}cm" />
</#macro>
<#macro rowM row table>
<fo:table-row><#list row.cells as cell><@cellM cell=cell table=table /></#list></fo:table-row>
</#macro>
<#macro cellM cell table>
<fo:table-cell<@cellFormattingM cell=cell table=table />><@blockObjectsM blockObjects=cell.blockObjects /></fo:table-cell>
</#macro>
<#macro cellFormattingM cell table>
<#if cell.border == true> border="0.1mm solid"</#if>
<#if cell.pad == true> padding="3pt"</#if>
<#if cell.shade == true> background-color="#eeeeee"</#if>
<#if table.collapse == true> margin-top="5px"</#if>
</#macro>