"EXT-Reddy, Swathi A" <[EMAIL PROTECTED]> wrote:

> Can someone please post a sample XSLT file that does the section breaks and
> page breaks depending on the XML file? I have a XML file that looks like
> this  -
> 
> <PAGE number="1">
>            ........
> </PAGE>
> <PAGE number="2">
> .....

Page breaks can be achieved by placing a break-before="page" or a
break-after="page" attribute on a block level FO. There are a lot
of different possibilities how to do this, what's appropriate heavily
depends an your context.
Here is one example which will work with the XML above:
  <xsl:template match="PAGE">
    <fo:block break-after="page">
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>
This will create a blank page after the last page, which could be
easily avoided with some conditional processing. Another potential
drawback is that the page numbers will be continuous and wont honor
the number attributes on the XML elements.

If you want to have the latter, you'll have to use page sequences:
  <xsl:template match="PAGE">
    <fo:page-sequence master-reference="some-master" 
         initial-page-number="{@number}">
      <xsl:apply-templates/>
    </fo:page-sequence>
  </xsl:template>

Last point: i hope you know what you are doing by expressing the
page structure in the XML. Are you sure the content of all XML
PAGE elements will always fit on the physical pages as defined
be the FO page masters?

> I can add SECTION tags to tell the XSL file where the section break is.

What's your definition of a section? It could be quite different from
mine.

HTH
J.Pietschmann

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to