This week's book giveaway is in the Agile forum.
We're giving away four copies of The Software Craftsman and have Sandro Mancuso on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes XML files to Excel Files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML files to Excel Files" Watch "XML files to Excel Files" New topic

XML files to Excel Files

Rafael Afonso
Ranch Hand

Joined: Jul 16, 2002
Posts: 63
Does Anyone know how to tranform a XML file to a Excel file using XSL transfoms? By the way, a XML file to any Micro$oft Office file (*.doc, *.ppt , etc.). I know that xls files are not a open specification, but PDF files are not too and we have FOP.

=================================<br /> Rafael U. C. Afonso<br /> <a href="" target="_blank" rel="nofollow"></a><br />=================================<br /><i>Where is debug?<br />debug is on the table</i>
John Coleman
Ranch Hand

Joined: Jul 24, 2001
Posts: 65
The simplest xls file consists of elements deliminated by tab characters organised into rows by terminating with a newline character.
You can create a variable called $newline with a value like this:
<xsl:variable name="newline">
No doubt you are aware XSLT usually outputs raw text, HTML or XML. However the normal xl formatted file contains all sorts of binary gubbins instead of nice tags that would probably be crazy to create in xslt.
IMO as xl also reads HTML, the nicest thing to do is generate a table in HTML using the usual <table><tr><td> syntax. I know that only goes half way, but it is clean and more "open", and a lot easier to figure out!

John Coleman, MSTA<br />Sun Certified Programmer for the Java� 2 Platform<br /><br />Eurobase banking solutions<br /><a href="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: XML files to Excel Files