Re: [xsl] inserting page-break after certain terms

Subject: Re: [xsl] inserting page-break after certain terms
From: Andreas Peter <info@xxxxxxxxxx>
Date: Wed, 04 Jul 2007 14:49:36 +0200
Quoting Tony Graham <Tony.Graham@xxxxxxxxxxxxxxxxxxxxxx>:

On Tue, Jul 03 2007 08:38:15 +0100, info@xxxxxxxxxx wrote:
...
I declared a local variable where I count the lines and convert them
to [mm] to achieve the height of a certain <section> which includes
several elements.

I know that the print space is 180mm high. Now I want to create a loop
where I count the height of <section> until it is smaller or even than
180mm and insert a page-break afterwards.

The next step should be to check if the rest of the space is 20mm,
40mm, 60mm and so on.

This is what I have written so far.


<xsl:choose> <xsl:when test="180 - sum($gesamt) = 20"> <xsl:apply-templates/> </xsl:when> <xsl:when test="180 - sum($gesamt) = 40"> <xsl:apply-templates/> </xsl:when> <xsl:when test="180 - sum($gesamt) = 60"> <xsl:apply-templates/> </xsl:when> <xsl:when test="180 - sum($gesamt) = 90"> <xsl:apply-templates/> </xsl:when> </xsl:choose>

I think after the page-break the variable $gesamt should be "zero". Is
this possible with ...select="0"?

Does anyone outthere have a hint for me how to solve this problem? If
I use the code above I only receive one block per page.

What you are attempting is not clear to me, at least. It may help if you can post a bit more of your solution.

Since you use xsl:apply-templates each time, why not just test that
sum($gesamt) <= 180?

I don't know if you expect the variable $gesamt to change, but it won't
be updated once assigned.

What sort of output are you producing? XSL-FO?

Regards,


Tony Graham. ====================================================================== Tony.Graham@xxxxxxxxxxxxxxxxxxxxxx http://www.menteithconsulting.com

Menteith Consulting Ltd             Registered in Ireland - No. 428599
Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
======================================================================




Okay. I try to be more precisely. Please excuse my "bad" English :-)


The problem is that I have to program a solution for the following case.
My output should be a brochure with XML contents transformed via XSLT
to XSL-FO/PDF.

I have several "blocks" all with more or less the same structure. They
are named <section>. After <section> there are several items. My
resulting page has a print space of 180mm.

Now the problem:
I have to calculate the height of each <section> in mm (what I have
already done, stored in "&gesamt"). Afterwards I need to sum the
height of all the <section> items including their children. Now if the
height of the summation is <= 180mm I need a page-break and start the
same scenario at the following page. Sum the height, look if <= 180mm,
output, page-break. Of course I think I have to update the variable
"$gesamt".

Okay, I hope this helps more :-)

Thanks,
Andreas

Current Thread