Re: [xsl] how to trigger a new page sequence, depending on specific input conditions

Subject: Re: [xsl] how to trigger a new page sequence, depending on specific input conditions
From: "Tony Graham" <tgraham@xxxxxxxxxx>
Date: Thu, 6 Oct 2011 14:37:28 +0100 (IST)
On Thu, October 6, 2011 1:29 pm, team wise wrote:
...
> FO implementations that are comprised of two separate
> <fo:page-sequence>, among others result in PDF that contains two back
> page.
>
> Solutions I have taken so far, which do not work as expected, are
> explained below:
>
> First, here is the 'insert.lastchapter' named template that triggers a
> new page sequence for the 'back page' only, which works just fine.
> Note that 'insert.lastchapter' is pretty much duplicate of the
> 'insert.chapter', which is briefly explained below.
>
> <xsl:template name="insert.lastchapter">
>   <xsl:param name="content"/>

What does $content do?  You don't seem to be using it.

>       <xsl:if test="$outputformat = 'UG_Booklet_Print'">
>         <xsl:for-each select="*[contains(@outputclass, 'pagebreak')]">

It's still not clear to me how much is being repeated that isn't wanted,
but this will process only the last element that has
'outputclass="pagebreak"' [2]:

   <xsl:for-each select="*[contains(@outputclass, 'pagebreak')][last()]">

It's also not clear to me whether there's anything that comes after the
last element that has 'outputclass="pagebreak"'.

>          <xsl:variable name="position" select="position()" />
>           <fo:page-sequence initial-page-number="auto" format="1">
>             <xsl:attribute
> name="master-reference">chapter-master</xsl:attribute>

That could have been a literal attribute.

...
>        <xsl:apply-templates select=". |
> preceding-sibling::*[count(preceding-sibling::*[contains(@outputclass,
> 'pagebreak')]) = $position - 1]" />
>     <fo:flow flow-name="region.body">

I would have thought that the xsl:apply-templates would have gone here,
not before the fo:flow.

>      </fo:flow>
>      </fo:page-sequence>
>   </xsl:for-each>
>    </xsl:if>
> </xsl:template>

Is it the case that all you really need is 'break-after="page"' or
'break-after="odd-page"' [1] on the fo:block for the element that has
'outputclass="pagebreak"'?

> Second, as indicated below, to prevent <fo:flow
> flow-name"region.body"> from flowing in the last node to appear on the
> last page or the back page repeatedly within 'insert.chapter', I have
> tried

I don't understand "prevent <fo:flow flow-name"region.body"> from flowing
in the last node".

Regards,


Tony Graham                                   tgraham@xxxxxxxxxx
Consultant                                 http://www.mentea.net
Mentea       13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
 --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
    XML, XSL FO and XSLT consulting, training and programming

[1] http://www.w3.org/TR/xsl11/#break-after
[2] And, if you keep the current contents of the xsl:for-each,
    maybe some of its siblings as well.

Current Thread