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

Re: How to arrange Pages in Fo

Expand Messages
  • Anand
    I am generating the PDF in the java program itself .So in the program unless i have all the document details i cant write the Table of Contents .So while
    Message 1 of 4 , Sep 6, 2001
    • 0 Attachment
      I am generating the PDF in the java program itself .So in the program
      unless i have all the document details i cant write the Table of
      Contents .So while constructing the document the table of contents is
      at the bottom.
      But i want that to appear at the top when the pdf is created .
      Is there any way we can take care of this????
      Help on this is highly appreciated.
      Anand



      --- In XSL-FO@y..., "Evensen, Lesley" <LEvensen@i...> wrote:
      > Seems like you would want to generate the table of contents as PDF,
      as
      > part of your output document, but if you want to know what the
      table of
      > contents is in your Java program (presumably on the server side, to
      > process differently based on the contents?) you don't want that in
      PDF;
      > I don't understand if you need the 'table of contents'
      information in
      > Java, or is it the case that you need the actual PDF in your Java
      > program?
      >
      > -----Original Message-----
      > From: Anand [mailto:a_pophale@y...]
      > Sent: Monday, September 03, 2001 3:14 AM
      > To: XSL-FO@y...
      > Subject: [XSL-FO] How to arrange Pages in Fo
      >
      >
      > 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
      program
      > at last but making this page appear as the first page????
      >
      > Help pls.....
      > Ragards,
      > Anand
      >
      >
      >
      > To unsubscribe from this group, send an email to:
      > XSL-FO-unsubscribe@egroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
    • 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 2 of 4 , Sep 7, 2001
      • 0 Attachment
        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 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:
        <?xml version='1.0'?>
        <Book Title="Some Title">
        <Chapter Title="First Chapter">
        <P>Some text for the first ch.</P>
        </Chapter>
        <Chapter Title="Second Chapter">
        <P>Some text for the second ch.</P>
        </Chapter>
        <Chapter Title="Third Chapter">
        <P>Some text for the third ch.</P>
        </Chapter>
        <Chapter Title="Fourth Chapter">
        <P>Some text for the fourth ch.</P>
        </Chapter>
        </Book>

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

        <xsl:stylesheet
        xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
        version='1.0'>

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

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

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

        <!-- 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"/>
        </xsl:for-each>
        </xsl:template>
        </xsl:stylesheet>

        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.

        Regards,
        Frank.



        --- 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
        program
        > 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.