You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Manuel Reyes <Ma...@e-mis.com> on 2003/11/19 18:51:51 UTC

Merging XML and FO files

Hello all,

I am currently working on an application that will pull data values from a database and place these into an XML file.  The resulting XML file is then to be merged with an FO template file and the result would be used to generate a PDF

The reason for the mail, is that I wanted to get opinions on the best way to go about doing this.  In my minds eye I have the following idea :

XML File (containing data values) :
<merge_test_report>
<field_values>
<value id="@value1">abc</value>
<value id="@value2">def</value>
</field_values>
<repeat_values>
<repeater id="1">
<values>
<value id="@mvalue1">rep 1a</value>
<value id="@mvalue2">rep 1b</value>
</values>
</repeater>
<values>
<value id="@mvalue1">rep 2a</value>
<value id="@mvalue2">rep 2b</value>
</values>
</repeater>
<repeat_values>
<merge_test_report>

FO File (containing the base layout for the pdf) :
<fo:table table-layout="fixed">
<fo:table-column column-width="10cm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block text-align="left">@value1 / @value2</fo:block>
</fo:table-cell>
</fo:table-row>
<!-- STARTREPEATMERGE id="1" -->
<fo:table-row>
<fo:table-cell><fo:block>@mvalue1 / @mvalue2</fo:block></fo:table-cell>
</fo:table-row>
<!-- ENDREPEATMERGE id="1" -->
</fo:table-body>

I would then create an application to read through the XML file and place its values into the FO template, which would create another FO file which would be processed by FOP.

This would generate a PDF with something similar to this format :

abc / def
rep1a / rep 1b
rep2a / rep 2b

Considering I currently have about 4 hours experience of FOP and XSL-FO I am insure on whether this is the best way to proceed, or if FOP has any functionality that will make my life easier - bearing in mind the ability to create repeated tables is a must.

I noticed from looking at the command line parameters for fop that there is an option for : 

Fop -xsl foo.xsl -xml foo.xml -pdf foo.pdf

Which leads me to believe that fop may already have what I need; unfortunately I can seem to pin down the documentation/samples covering that functionality.

Regards
 
Manuel Reyes

PS. The XML/XSL above may not be 100% correct, as it was just typed quickly into the message.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: Merging XML and FO files

Posted by al...@owal.co.uk.
Manuel.Reyes@e-mis.com wrote:
> Hello all,
> 
> I am currently working on an application that will pull data values from =
> a database and place these into an XML file.  The resulting XML file is =
> then to be merged with an FO template file and the result would be used =
> to generate a PDF

Sounds like Cocoon to me. Cocoon is a framework which happens to use Fop for its PDF rendering. The learning curve may be a bit steep though.

Also possibly xReporter....

Finding URLs is left as an exercise for the reader. 


Alex



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org