How to manipulate page number in FOP?

匆匆过客 提交于 2019-12-07 15:48:54

问题


I am using Apache FOP 0.95, and all I want to do is add 1 to the current page number.

So, on page 12, I want to show 12 / 13. Then nothing on page 13, of course.

Any ideas how I could do this, perhaps by manipulating <fo:page-number /> ?

Thanks y'all!


回答1:


Short answer for this is that you can't achieve the result you after with straight FO.

This is because you can't programatically access the page-numbers until FOP has assigned them, so your XSLT doesn't know what they are.

You can get round this using a 2 pass approach, where you manipulate the intermediate format (after its been through FOP) and re-process into target format. At least this is the approach I use when using RenderX XEP (Other XSL-FO Renderer) using its XEPOUT format (I assume FOPs works in a similar way see http://xmlgraphics.apache.org/fop/0.94/intermediate.html).

Cheers, Mike



来源:https://stackoverflow.com/questions/2958515/how-to-manipulate-page-number-in-fop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!