Hi, I''m looking for advice on step #2 below. I''m wondering whether I should do it this way, or if there''s some way to use an rhtml/rxml template, execute that template and then assign the results to a file for conversion into a pdf by fop. 1. Get data from database This step is easy. 2. Generate XSL-FO from template using data - Loop over data and build the xsl-fo in a variable? Save variable data to file? 3. Convert XSL-FO to PDF using FOP I''d also like to add the results of this to Using FOP under the HowtoGeneratePDFs Howto. Thanks
Just stick the template in a view, and access the relevant controller. ERb doesn''t really care if it''s generating HTML, XML or plain text, so you can just stick the FO tags in there, and be done with it. Actually, given that you can move all the FO header-bits to a layout template, it''s a remarkably clean way of generating the XSL. -- Alex On 5 Oct 2005, at 18:31, James Earl wrote:> Hi, > > I''m looking for advice on step #2 below. I''m wondering whether I > should do it this way, or if there''s some way to use an rhtml/rxml > template, execute that template and then assign the results to a file > for conversion into a pdf by fop. > > 1. Get data from database > > This step is easy. > > 2. Generate XSL-FO from template using data > > - Loop over data and build the xsl-fo in a variable? Save variable > data to file? > > 3. Convert XSL-FO to PDF using FOP > > I''d also like to add the results of this to Using FOP under the > HowtoGeneratePDFs Howto. > > Thanks > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
At 5:34 PM +0100 10/6/05, Alex Young wrote:>Just stick the template in a view, and access the relevant >controller. ERb doesn''t really care if it''s generating HTML, XML or >plain text, so you can just stick the FO tags in there, and be done >with it. Actually, given that you can move all the FO header-bits >to a layout template, it''s a remarkably clean way of generating the >XSL.It sounds like the extension for these view files would be rxml, as XSL-FO is an XML dialect. What should the procedure be for other output formats? How do I tell Rails to create a format "foo" from (say) an "rfoo" file? Also, how do I tell Rails to initiate the processing of the "foo" file into the final output format? -r -- email: rdm-go8te9J4rpw@public.gmane.org; phone: +1 650-873-7841 http://www.cfcl.com - Canta Forda Computer Laboratory http://www.cfcl.com/Meta - The FreeBSD Browser, Meta Project, etc.
On 10/6/05, Alex Young <alex-qV/boFbD8Meu8LGVeLuP/g@public.gmane.org> wrote:> Just stick the template in a view, and access the relevant controller. > ERb doesn''t really care if it''s generating HTML, XML or plain text, so > you can just stick the FO tags in there, and be done with it. > Actually, given that you can move all the FO header-bits to a layout > template, it''s a remarkably clean way of generating the XSL.Thanks for the reply, So, once I have the FO accessable from a view, I should be able to pipe the results to FOP from another controller method. I noticed IO.popen from some of the other PDF howto examples. Looks like it might do the trick. def gen_fo # generate xsl-fo end def download_pdf # pipe to fop using IO... then send to client using send_data end