Link to home
Start Free TrialLog in
Avatar of jonpers
jonpers

asked on

XSL transformation that converts XML to Excel?

Hi.

I would like to do the following-

The results of a query are sent to the client as XML and displayed on-screen as an HTML table using an XSL. However, I'd like to give users the option to click a button which will open Excel inside their browser and display the data there. I know how to use Javascript to change the XSL file being used on the client and re-transform the data, so really I want to know how to use an XSL to create a CSV file (probably) with an application/vnd.ms-excel content type.

Thanks in advance,
JP
Avatar of b1xml2
b1xml2
Flag of Australia image

to expedite matters, what dont you provide your sample XML and expected CSV syntax.

Also, the CSV syntax could be sent via an ASP Page without any need to save it as a file anywhere.

e.g.
<%
Response.ContentType = "application/vnd.ms-excel"
....
oXML.transformNodeToObject oXSL, Response
%>
Avatar of jonpers
jonpers

ASKER

I don't actually have an example of my XML yet - I'm just working on a concept.

As for the CSV format, I don't really mind, it's possible that CSV is not the best solution. The main thing is to get the data displayed in an in-place Excel window in the browser without having to re-send all the data.

The ASP solution is nice but
a) I am working on a JSP server and
b) It doesn't allow me to change the format on the client side, it would have to be done server-side.
yes, that's my point with regard to the ASP thingy,

You can set the Content-Type HTTP Header to "application/vnd.ms-excel" on the JSP Server and output the transform on the server-side. The client will see the header and if it has Excel will load the csv inside excel.
Avatar of jonpers

ASKER

I don't think you understand what it is I'm trying to achieve.

I want to be able to dynamically change the format of the output between html and excel on the client without re-downloading the data.
listening ...
ASKER CERTIFIED SOLUTION
Avatar of SpideyMod
SpideyMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Has anyone ever firgured out how to convert XML to Excel on the Client Side without making a round trip back to the server?