XSLT or OWN Logic for transformation

Posted on 2010-04-09
Medium Priority
Last Modified: 2013-12-31
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.
Question by:nkaushik
  • 2

Expert Comment

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

Access:  http://databases.about.com/od/tutorials/ht/createpdf2007.htm
LVL 60

Accepted Solution

Geert Bormans earned 500 total points
ID: 30214288
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

Author Comment

ID: 30492051
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  )
LVL 60

Assisted Solution

by:Geert Bormans
Geert Bormans earned 500 total points
ID: 30493457
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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question