0

我在为 BI 发布者创建 RTF 模板时遇到了一个问题。我在RTF 模板的标题(不是 MS 字标题,而是标识为start:body标记上方的标题)中显示一个表格。该表有 3 行,我只需要在第一页而不是在其他页面中显示其中一行。

我没有找到任何查询页码的方法。所以,我以如下方式使用了一个标志:(这里,后缀 _f 表示 RTF 字段)。以下是我的 RTF 文件的样子:

+---------------------------------------------------------------------------------+
¦ init_f ¦    Row to be shown on all the pages     ¦                              ¦
¦--------+-----------------------------------------+------------------------------¦
¦ if_f   ¦ Row to be shown on the first page only. ¦   end_if_f change_variable_f ¦
+---------------------------------------------------------------------------------+

<?start:body?>

other stuff

<?end body?>

在哪里,

初始化_f

<?if: (xdoxslt:get_variable($_XDOCTX,'FLAG')!='NONFIRST')?><?xdoxslt:set_variable($_XDOCTX,'FLAG','FIRST')?><?end if?>

if_f

<?if: (xdoxslt:get_variable($_XDOCTX,'FLAG'))='FIRST'?>

end_if_f

<?end if?>

change_variable_f

<?xdoxslt:set_variable($_XDOCTX,'FLAG','NONFIRST')?>

但是,我仍然看到所有页面中的所有行。似乎变量'FLAG'的值没有在不同页面之间保留。对我来说,似乎只生成了一次标题,并且在所有页面中都使用了相同的标题。解决办法是什么?

4

1 回答 1

0

创建不同的模板并按如下方式调用它们

<?call-template:tHEADER_VERSO?>
<?start:body?>
<?call-template:tHEADER_RECTO?>
<?for-each@section:XMLELEMENT?>
<?call-template:tDETAILS?>
<?end for-each?>
<?end body?>
<?call-template:tFOOTER?>

定义模板

<?template:tDetail?>
  text content
<?end template?>
于 2013-10-10T14:41:55.203 回答