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

RE: [XSL-FO] FOP and multiple fo files?

Expand Messages
  • Robert Riggins
    My original response wasn t clear. The include statements are Freemarker code. Each file that goes into the PDF has different margins and formatting. The
    Message 1 of 7 , Mar 9, 2005
    • 0 Attachment
      My original response wasn't clear. The include statements are Freemarker
      code.

      Each file that goes into the PDF has different margins and formatting.
      The different formats are handled in the layout-master-set elements.
      Each different section has it's own simple-page-master element
      identified by the master-name attribute.

      I'm not sure I've helped you yet.

      DaveP asked if entities or xincludes would work better. I don't know
      what those are, so I can't really give an answer. Maybe Dave could
      expand on his question.

      Another programmer I work with, set this up, so I'm not intimately
      familiar with it all. However, I will try to help you. If necessary, I
      could zip up the structural files and send them to you.

      Thanks,
      Rob Riggins

      -----Original Message-----
      From: Fournier,Danny [NCR] [mailto:Danny.Fournier@...]
      Sent: Monday, March 07, 2005 6:38 AM
      To: XSL-FO@yahoogroups.com
      Subject: RE: [XSL-FO] FOP and multiple fo files?


      You couldn't pass file1.fo, file2.fo, file3.fo as parameters and only
      generate one PDF from them? The goal is to simply combine various files
      into one PDF. Each file may have different formatting thus cannot be
      generated from includes using one file. (ie. Margin, orientation,
      etc...)

      Thanks everybody,

      Dan

      -----Original Message-----
      From: Dave Pawson [mailto:DaveP@...]
      Sent: March 5, 2005 5:47 AM
      To: XSL-FO@yahoogroups.com
      Subject: RE: [XSL-FO] FOP and multiple fo files?



      On Fri, 2005-03-04 at 15:52 -0600, Robert Riggins wrote:

      > We use include statements.

      > Example------------
      >
      > <fo:page-sequence master-reference="cover">
      > <#include "bodyc.fo.ftl">
      > </fo:page-sequence>

      Wouldn't entities or xinclude be more normal
      for this kind of application?

      regards DaveP




      Yahoo! Groups Links










      Yahoo! Groups Links
    • Maxim
      Long time has passed since the last post on this topic so I hope this is still useful. My Java application does exactly that. It applies different xslt style
      Message 2 of 7 , Apr 7, 2005
      • 0 Attachment
        Long time has passed since the last post on this topic so I hope this
        is still useful.

        My Java application does exactly that. It applies different xslt style
        sheets to different data inputs and creates one PDF report. My
        application runs each xsl-fo generation process separately storing the
        output in a byte array. When all the pdf snippets are generated it
        uses a free Java library iText (http://www.lowagie.com/iText/) to
        combine the PDF snippets together into one PDF document.

        Hope this helps,
        Max Z.


        --- In XSL-FO@yahoogroups.com, "Fournier,Danny [NCR]"
        <Danny.Fournier@e...> wrote:
        > You couldn't pass file1.fo, file2.fo, file3.fo as parameters and only
        > generate one PDF from them? The goal is to simply combine various files
        > into one PDF. Each file may have different formatting thus cannot be
        > generated from includes using one file. (ie. Margin, orientation,
        > etc...)
        >
        > Thanks everybody,
        >
        > Dan
      • Mike Trotman
        There s one solution to this that I posted in October 2003. Sorry if the paste is a bit spread out. The key processing code is on line 50-54 of the XSLT below.
        Message 3 of 7 , Apr 12, 2005
        • 0 Attachment
          There's one solution to this that I posted in October 2003.

          Sorry if the paste is a bit spread out.

          The key processing code is on line 50-54 of the XSLT below.

          I do a similar thing for very large PDF files.
          (I save the individual .FO files for fast formatting into user selected
          options for various pages.)
          You may have refinements needed for you process which I miss but here is
          a 'simple' solution that keeps memory overhead low as well.

          The way I do this is to put all necessary FO into each individual file
          but construct a master 'index' XML document that contains references to
          each individual file required.
          This should contain any summary information required for TOCs, cross
          references etc.

          I then process this master document with a stylesheet that produces
          output FO, usually with many separate page-sequence (usually one per
          sub-file) and, using the XSLT 'document' function parses each sub
          document and includes just the relevant nodetrees (for my purposes
          usually just the page-sequences as I use an overall set of common master
          page-masters).
          (The nice thing is that this 'combining' stylesheet can be very generic
          and used for assembling many different documents.)

          This approach also makes it easy to assemble a combined output from
          selected, different sets of input subfiles (and also allows some limited
          reformatting if differing page sizes are required).

          I've used this to process documents that would actually be several
          hundred megabytes in size if produced as a single FO file.

          In case it helps to make things clearer here is an example of a very
          simple master stylesheet to merge separate FO files by processing a
          master XML file containing the names of the files to be processed.



          The FO files names are stored in
          /SECTIONS/SECTION/TABLES/TABLE/TABFIL/@href_fo.

          'dl_dotags.xsl' processes a file containing layout parameters and
          defines the template DL_FO_ATTR.



          1 <xsl:stylesheet version="1.1"
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform" <http://www.w3.org/1999/XSL/Transform>

          2 xmlns:fo="http://www.w3.org/1999/XSL/Format" <http://www.w3.org/1999/XSL/Format>

          3 xmlns:dl='http://www.datalucid.com/' <http://www.datalucid.com/%27>

          4 >

          5 <xsl:output method="xml" encoding="UTF-8"
          omit-xml-declaration='yes' indent='yes'/>

          6 <xsl:decimal-format name="nan0" NaN="0"/>

          7

          8 <!-- 11.27in = 29cm ??? -->

          9 <xsl:param name='PAGEWID_CM' select='29'/>

          10 <xsl:include href='dl_dotags.xsl'/>

          11 <!-- ############################################################ -->

          12 <!-- XSLT for DLXML - Author: Mike Trotman - 03/10/2002 -->

          13 <!-- ############################################################ -->

          14 <xsl:template match="/">

          15

          16 <fo:root xmlns:fo='http://www.w3.org/1999/XSL/Format' <http://www.w3.org/1999/XSL/Format%27>>

          17

          18 <fo:layout-master-set>

          19 <fo:simple-page-master master-name='first'>

          20 <xsl:call-template name='DL_FO_ATTR'><xsl:with-param
          name='RULE' select='"page"'/></xsl:call-template>

          21 <fo:region-body>

          22 <xsl:call-template name='DL_FO_ATTR'><xsl:with-param
          name='RULE' select='"region-body"'/></xsl:call-template>

          23 </fo:region-body>

          24 <fo:region-before>

          25 <xsl:call-template name='DL_FO_ATTR'><xsl:with-param
          name='RULE' select='"region-before"'/></xsl:call-template>

          26 </fo:region-before>

          27 <fo:region-after>

          28 <xsl:call-template name='DL_FO_ATTR'><xsl:with-param
          name='RULE' select='"region-after"'/></xsl:call-template>

          29 </fo:region-after>

          30 </fo:simple-page-master>

          31 </fo:layout-master-set>

          32

          33 <xsl:apply-templates select="SECTIONS/SECTION"/>

          34

          35 </fo:root>

          36 </xsl:template>

          37 <!-- ############################################################ -->

          38 <xsl:template match="SECTION">

          39 <xsl:variable name='sid' select='count(preceding::SECTION)'/>

          40 <xsl:for-each select='TABLES/TABLE'>

          41 <xsl:choose>

          42 <xsl:when test='TABFIL/@href_fo'>

          43 <xsl:message>FO Table lookup <xsl:value-of
          select="@tableno"/></xsl:message>

          44 <xsl:apply-templates
          select='document(TABFIL/@href_fo)/*' mode='FO'/>

          45 </xsl:when>

          46 </xsl:choose>

          47 </xsl:for-each>

          48 </xsl:template>

          49 <!-- ############################################################ -->

          50 <xsl:template match='fo:root' mode='FO'>

          51

          52 <xsl:copy-of select='./fo:page-sequence'/>

          53

          54 </xsl:template>

          55 <!-- ############################################################ -->

          56 </xsl:stylesheet>








          Fournier,Danny [NCR] wrote:

          >You couldn't pass file1.fo, file2.fo, file3.fo as parameters and only
          >generate one PDF from them? The goal is to simply combine various files
          >into one PDF. Each file may have different formatting thus cannot be
          >generated from includes using one file. (ie. Margin, orientation,
          >etc...)
          >
          >Thanks everybody,
          >
          >Dan
          >
          >



          --
          No virus found in this outgoing message.
          Checked by AVG Anti-Virus.
          Version: 7.0.308 / Virus Database: 266.9.6 - Release Date: 11/04/2005
        Your message has been successfully submitted and would be delivered to recipients shortly.