Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
| Search | Today's Posts | Mark Forums Read
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 25th, 2008, 01:58 AM
Registered User
 
Join Date: Mar 2008
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Multiple FOP files to single PDF using XSL

hi ,

can anybody tell me is there a method to convert multiple FOP files to single PDF document using XSLt...
The requirement is tat we have multiple html files that needs to be
converted to FOP files, since XSLt processor cmd does not allow multiple html files to be converted to single fop file....
we need to convert the multiple FOP files to single pdf document using xslt.....

  #2 (permalink)  
Old March 25th, 2008, 07:21 AM
Friend of Wrox
Points: 1,676, Level: 16
Points: 1,676, Level: 16 Points: 1,676, Level: 16 Points: 1,676, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2006
Location: , , .
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Hi,

By FOP files do you mean xsl-fo (myfile.fo)?

If so, I use the SAXON 9.0 XSLT 2.0 processor for converting XML to FO. SAXON allows the uses of the collection() function which can process all files in a folder. Then I use FOP to convert the FO to PDF. Its a two step process. This is also useful, so I can troubleshoot any errors in my FO.

My XSLT calls up about 800 xml files and creates one FO file, which is then converted to PDF with FOP 0.94. This way I can create a "book" with an LEP, TOC, INDEX etc.. from 800 XML files.



  #3 (permalink)  
Old March 25th, 2008, 07:47 AM
Registered User
 
Join Date: Mar 2008
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

my requirement is to convert multiple html files to single pdf document using xslt.... fo means myfile.fo file itself....

  #4 (permalink)  
Old March 25th, 2008, 09:54 AM
Friend of Wrox
Points: 1,676, Level: 16
Points: 1,676, Level: 16 Points: 1,676, Level: 16 Points: 1,676, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2006
Location: , , .
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Hi,

Then my example applies.

Create an XSLT 2.0 file, that will take all your XHTML files and create 1 (one) FO. Then transform to PDF with FOP.

Good luck


  #5 (permalink)  
Old March 25th, 2008, 11:31 PM
Registered User
 
Join Date: Mar 2008
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks ...tat really helped me a lot.... can u put the link for the example u have

  #6 (permalink)  
Old March 26th, 2008, 05:16 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You seem to be having trouble knowing where to start, but it's difficult to help you because you've told us so little about the problem. If I were you I would spend a little time reading - you'll find lots of worked examples in my XSLT Programmer's Reference book for example.

There are two particular aspects raised by your problem:

(a) your input is HTML but XSLT requires XML. There are many ways to convert HTML to XML (for example using jtidy) - it depends a lot on how "clean" the HTML is to start with, and on how you want to deploy this application (is it a one-off, or a regular production job?)

(b) your transformation needs to read multiple input files. That's not difficult - you can read them using the document() or collection() functions - but the details depend on how you want to supply the list of files. Are you processing all the files in a directory? Or are you following hyperlinks from one document to another?

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
  #7 (permalink)  
Old March 27th, 2008, 01:19 AM
Registered User
 
Join Date: Mar 2008
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ya wat u said was right... i went through some examples...
my requirement kept on changing...
we wanted to develop "help" for our application like the one in eclipse ...
so i used xalan to convert xml or html to fop files and then to pdf files...
i was asked to merge the multiple html or xml docs to one single html or xml.... i did tat ...but they were not satisfied with the solution...
so they came up with another option .... it was tat multiple pdf docs say chapter1,2,3,.... needs to be merged to single pdf doc.... so tat whenever i make a change in some section of chapter 3...or new chapter is added... the chapter and section numbers need to be automatically updated in merged pdf....

i tried using pdf merger tool...but it didn support for chapter numbers or section numbering automatically changed....

can anybody help me in finding the tool

  #8 (permalink)  
Old March 28th, 2008, 05:59 AM
Friend of Wrox
Points: 1,676, Level: 16
Points: 1,676, Level: 16 Points: 1,676, Level: 16 Points: 1,676, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2006
Location: , , .
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Hi,

I know exactly what you are trying to do. Why dont you try my approach?



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using XSL to generate single pdf doc bhavanimachani XML 2 March 24th, 2008 11:57 PM
XSL multiple files in table (nested for-each ?) pedoublety XSLT 5 August 21st, 2007 08:00 AM
Save (output to) multiple files from single click moo_desanta Classic ASP Basics 2 June 23rd, 2006 02:00 AM
xsl matching with single file javaclimber XSLT 2 September 14th, 2005 12:16 AM
problem with empty block tag in xsl-fo and fop enT XSLT 0 October 14th, 2003 08:09 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.