【问题标题】:problem with deciding whether to or not to print heading on last page : xsl-fo决定是否在最后一页打印标题的问题:xsl-fo
【发布时间】:2011-03-15 05:15:53
【问题描述】:

嗨 我在使用 xsl-fo 生成 pdf 时遇到问题。每页中的 pdf 打印发票行。 因此,在最后一页有一个条件检查,以确定是否在最后一页打印标题。如果最后一页有一行或多行,则应该有一个标题。否则不行。

目前是使用下面的逻辑完成的

if(total number of invoice lines== preceding::number of invoice lines+1)
{
 call an empty marker
}
else
{
call a marker which prints the heading
}

当前面的发票行数+1 等于发票行总数时,将不显示标题。当最后一页中没有要显示的行或最后一页中的行数大于 1 时,此逻辑成立。

现在的问题是,

当最后一页只有一行时,上述逻辑失败。

条件 if(total number of invoice lines==preceeding::number of invoice lines+1) 将变为真,并且将调用一个不显示标题的空标记。即使最后一页只有一个发票行,我也需要显示标题。

有没有办法解决这个问题?

感谢任何帮助。

-阿伦

截图:

以下屏幕截图显示了一张两页的发票。

以下屏幕截图显示了最后一页,其中包含两个发票行。当最后一页只有两行时,逻辑成立。

http://img97.imageshack.us/i/85089628.jpg

但是当最后一页只有一行时,条件检查 if(total number of invoice lines==preceeding::number of invoice lines+1) 为真且不显示标题。

http://img222.imageshack.us/i/49057497.jpg

【问题讨论】:

  • 我不明白这个问题。在什么情况下,您会有一个页面但没有要处理的内容?您的分页逻辑似乎没有遵循您的数据内容。
  • @Alejandro 我附上了一些屏幕截图。请检查他们
  • img6.imageshack.us/i/26076949.jpg 这是使用的逻辑

标签: xslt pdf-generation xsl-fo markers


【解决方案1】:

您可以使用 OR 条件扩展您的 if 条件。我现在不知道确切的语法,但可能类似于

if(total number of invoice lines != 1 ||
   total number of invoice lines== preceding::number of invoice lines+1)
{
 call an empty marker
} ...

可能会起作用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-04
    • 2015-12-18
    • 2011-12-29
    • 2013-12-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多