Loading ...
Sorry, an error occurred while loading the content.

Re: How to arrange Pages in Fo

Expand Messages
  • neuggs@concentric.net
    Anand, There really isn t a way to deal with the result try after the fact. However, depending on the organization of the XML, I d think something like a TOC
    Message 1 of 4 , Sep 7, 2001
    • 0 Attachment

      There really isn't a way to deal with the result try "after the
      fact." However, depending on the organization of the XML, I'd think
      something like a TOC could be "calculated" using XSLT.

      Here's an example of what I mean. (Note that I omitted all the FO
      stuff in order to clearly illustrate the point of ordered processing
      via XSLT.)

      <?xml version='1.0'?>
      <Book Title="Some Title">
      <Chapter Title="First Chapter">
      <P>Some text for the first ch.</P>
      <Chapter Title="Second Chapter">
      <P>Some text for the second ch.</P>
      <Chapter Title="Third Chapter">
      <P>Some text for the third ch.</P>
      <Chapter Title="Fourth Chapter">
      <P>Some text for the fourth ch.</P>

      XSL Stylesheet:
      <?xml version='1.0'?>


      <xsl:template match="/">
      <!-- Create TOC -->
      <xsl:call-template name="TOC">
      <xsl:with-param name="Book" select="Book"/>

      <!-- Process the document as always -->
      <xsl:apply-templates select="Book"/>

      <!-- "Normal" template -->
      <xsl:template match="Chapter">
      <xsl:value-of select="@Title"/>
      <xsl:value-of select="./P"/>

      <!-- Named template for TOC -->
      <xsl:template name="TOC">
      Table Of Contents
      <xsl:for-each select="$Book/Chapter">
      <xsl:value-of select="position(.)"/>
      <xsl:value-of select="@Title"/>

      What I do first is call a named template (i.e., "TOC") and pass it
      the data I want it to deal with (the "Book" element and everything
      under it) for the TOC. In that template, I iterate through
      the "Chapter" elements and print out a TOC.

      Then, after the call to the named template, I simply process the
      document as always (i.e., using apply-templates or whatever). The
      result isn't pretty, but I wasn't trying to format the output, just
      get the output in the order I intended.

      Hope this helps.


      --- In XSL-FO@y..., "Anand" <a_pophale@y...> wrote:
      > Hi,
      > I am generating FO in a java program.I need to generate the 'table
      > of Contents' page at last in my java program.
      > But i want this page to appear as the first page in the PDF.
      > Can i do so???I mean generating the table of contents in the
      > at last but making this page appear as the first page????
      > Help pls.....
      > Ragards,
      > Anand
    Your message has been successfully submitted and would be delivered to recipients shortly.