XSLT or OWN Logic for transformation

I have records in database, I want to generate a report in pdf / .csv, should I use XSLT or directly use java code for desired output.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

What type of database are you using (Access, MSSQL, MySQL, etc.)?

Access:  http://databases.about.com/od/tutorials/ht/createpdf2007.htm
Geert BormansInformation ArchitectCommented:
I see no reason for using XSLT for this
- A simple SQL query on the database will give you the csv you need
- For PDF, you could use export to XML, create XSL-FO using XSLT and use FOP to create PDF from the FO. That is how I would do it, but XSLT is the main trick in my toolbox. And FOP has limitations on laying out tables. There are tons of libraries for generating PDF directly from java... I would go down that route: http://java-source.net/open-source/pdf-libraries
Als it might be worthwhile to go via spreadsheet libraries from java, rather than XML, depends on how interactive you want the process to be

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nkaushikAuthor Commented:
Right now database is mysql, but it can be sql server or oracle in future so solution should be independent of provider. So question is, in this particular scenerio so I go ahead with java code which can export data receivedfrom database to csv/pdf/text file or through XSLT.

Data from any database server --> any format ( theortically ) but initally to csv and pdf only.

whether to use Java code or achieve it through XSLT ( which one would be better and why  )
Geert BormansInformation ArchitectCommented:
If the data comes from any database server....
1 you either need to develop an export to a common XML format in each and every server. After that you can use XSLT
2 or you use a database abstraction such as "hibernate" in java or "active record" in ruby, so you don't care about which DB is in the background

I would use at least an abstraction as in 2. But this abstraction could go to XML too (I do that a lot using Active Record and Ruby, or even Data Direct tools with XQuery if the project has the budget)

Then, the "any format". We can only advice if we have a slightest idea what this "any format" can be. If you come up with XHTML, XML and Excell as the next three, an XML pivot in the center would be the solution.

We also don't know about your skillset. Are you a java programmer. Do you know any of these technologies?

I would have choosen Java from your first question, but there are too many unknowns.
Based on my skillset, I would use Ruby and Active Record, to make a database abstraction into XML, and use XSLT from there,
but if you have yet to learn all these tehnologies, and you are into Java, go down that route. None are wrong
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.