RE: Multiple XMLs to One PDF.

David,

Thanks for another very interesting email and idea that you included at the
end of your email.  

Here's my dilemma in a nutshell: 

I have a page on our website that would be similar to a sitemap page that
will list all of the pages (nodes) in our entire website in a hierarchical
format.  Each node will have a checkbox right next to it so that user can
select any number of nodes and click a button at the bottom of the screen
called "Convert to PDF".  Once the "Convert to PDF" button is clicked, a JSP
will take control and get all the XML and corresponding XSL (its really
XSL-FO) files for all nodes that are selected.  I want that JSP to transform
each XML using the corresponding XSL and put the entire output into ONE
master PDF and give it to the user.

I am using Apache's FOP to achieve this.  I have successfully implemented it
where I can convert any one node to pdf and it works fine.  In Apache's FOP,
out-of-box, it outputs the pdf file to any path/location that you specify.
I tried to see if I could have the FOP return some data back to the JSP
instead of writing it out to a file so that way I can in the end combine all
individual data from each transformation and write it out to a pdf file but
I dont think thats possible without making major changes in the Apache FOP's
source packages.  Plus it would be maintenance nightmare as well.  

What do you suggest is the best route?  Can you elaborate more on the idea
that you discussed towards the end of your last email and provide more
details.

In that idea you suggested to do individual transformations and then merge
them - but with out-of-box FOP once I do the transformation (I have to
provide the XML and XSL-FO to do the transformation) it will automatically
output the PDF for that XML file to a given location.  So now I have to
merge PDFs and not XML stylesheets.

I really appreciate all your help.  

Thanks,
Viral.

-----Original Message-----
From: David Carlisle [mailto:davidc@nag.co.uk]
Sent: Friday, March 12, 2004 9:14 AM
To: viral.patel@countryfinancial.com
Cc: www-xsl-fo@w3.org
Subject: Re: Multiple XMLs to One PDF.




> 2. I have 3 different XSLs that I want to use for each XML: 
ah that makes it more interesting.

You can't really do that in xslt 1, but you can achieve the effect so
long as the three stylesheets are written to use  modes on all templates
and uses of apply-templates, a different mode in each stylesheet.

then

you can have a top level stylesheet that imports all three stylesheets,
and if it wants to transform a document with the stylesheet using mode
one (say) you'd do

<xsl:apply-templates match="document(@href)" mode="one"/>

when this is executed, even though all your stylesheets have been
imported, only the templates from the stylesheet using mode one will
fire.


there are of course alternative strategies.

While joining pdf files together requires specialist software (or a very
very careful reading of the pdf spec) it isn't so hard to merge FO files
together.

You may prefer to do all your transformations separately, using
different stylesheets then use a final "merging" xslt stylesheet that
use the document() function to pull in all the individual stylesheets,
and pull them all under one fo:root. That way you don't need to worry
about combining the transform and the merge. For each FO document you
just need to navigate down to teh part you want and then copy the whole
subtree using xsl:copy-of into your combined FO file.

David


________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Received on Friday, 12 March 2004 10:39:14 UTC