problem with deciding whether to or not to print heading on last page : xsl-fo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

problem with deciding whether to or not to print heading on last page : xsl-fo

Arun Vijay
Hi i have a problem with pdf generation using xsl-fo. The pdf print invoice lines in each page. So there is a conditional checking at the last page to determine whether to or not to print the heading on last page. If there is one or more lines in the last page then there should be a heading. Otherwise not. currently it is done using the logic below
if(total number of invoice lines== preceding::number of invoice lines+1)
{
 call an empty marker
}
else
{
call a marker which prints the heading
}
when preceding number of invoice lines+1 is equal to total number of invoice lines, heading will not be displayed. The logic holds true when there is no more lines to be displayed in the last page or when the number of lines in last page is greater than one. Now the problem is, the above logic fails when there is only one line in the last page. The condition if(total number of invoice lines==preceeding::number of invoice lines+1) will become true and an empty marker will be called which will not display the heading. I need to display the heading even if there is only one invoice line in the last page. Is there any way to solve this problem? Any help is appreciated. Arun
Reply | Threaded
Open this post in threaded view
|

Re: problem with deciding whether to or not to print heading on last page : xsl-fo

Tony Graham-3
On Tue, March 15, 2011 5:33 am, Arun Vijay wrote:

>
> Hi i have a problem with pdf generation using xsl-fo. The pdf print
> invoice
> lines in each page. So there is a conditional checking at the last page to
> determine whether to or not to print the heading on last page. If there is
> one or more lines in the last page then there should be a heading.
> Otherwise
> not.
>
> currently it is done using the logic below
>
>
> if(total number of invoice lines== preceding::number of invoice lines+1)
> {
>  call an empty marker
> }
> else
> {
> call a marker which prints the heading
> }
>
>
> when preceding number of invoice lines+1 is equal to total number of
> invoice
> lines, heading will not be displayed. The logic holds true when there is
> no
> more lines to be displayed in the last page or when the number of lines in
> last page is greater than one.
>
> Now the problem is,
>
> the above logic fails when there is only one line in the last page.
>
> The condition if(total number of invoice lines==preceeding::number of
> invoice lines+1) will become true and an empty marker will be called which
> will not display the heading. I need to display the heading even if there
> is
> only one invoice line in the last page.
>
> Is there any way to solve this problem?

I fear that I am not understanding the issue, but what happens if you
remove the '+1'?

For that matter, why is there a test at all?  I.e., can every line always
include the marker?

Regards,



Tony Graham                         [hidden email]
Director                                  W3C XSL FO SG Invited Expert
Menteith Consulting Ltd                               XML Guild member
XML, XSL and XSLT consulting, programming and training
Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
Registered in Ireland - No. 428599   http://www.menteithconsulting.com
  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
xmlroff XSL Formatter                               http://xmlroff.org
xslide Emacs mode                  http://www.menteith.com/wiki/xslide
Unicode: A Primer                               urn:isbn:0-7645-4625-2


Reply | Threaded
Open this post in threaded view
|

Re: problem with deciding whether to or not to print heading on last page : xsl-fo

Arun Vijay
count(preceding::number of invoice lines) will give the number of lines up to current line (not including the current line). So 1 must be added to get actual no. of lines.

i hope the following images gives you a better idea.

this is the logic used


This is the general kind of invoice received. No problem with heading in the last page


When there are only two lines in the last page, the logic still holds


But when there is only one line in the last page the conditional check 
if(total number of invoice lines==preceeding::number of invoice lines+1)  become true and the heading is not displayed.