How to merge 2 xml docs with xslt?

Is "use JavaScript to transfer xslt + xml => html in client-side" a good solution?

  • I have several (maybe 5) templates there, and some data. I want to fill the data in the templates. Template likes a table, maybe 5 rows, 5 cells in a row, with some data fixed, some data needs to fill in. If I use xslt to defines template, use xml to save data, use JavaScript to transfer it to html in client-side, Is there some problems? Is this a good solution?

  • Answer:

    There are so many client side templating frameworks to choose from. Take a look at this: http://engineering.linkedin.com/... I would also ditch XML in favour of JSON. JSON tends to have better support in the javascript world, and is a lot more compact and readable.

Ryan Phung at Quora Visit the source

Was this solution helpful to you?

Other answers

I wouldn't say so; the XSL implementation in most browsers is sub-par and haven't been actively maintained or updated. If you really want to do XSL transforms you're better doing them on the server side, and using JSON and JavaScript if you need to update a static HTML page with new data client-side.

Phillip Oldham

Phillip is right; using XSLT on the client side is not a good idea. Instead of doing that run an XSLT script on the server to transform the XML into HTML, which you canĀ  then download to the client.

George Gombay

It all depends on your requirements. They drive everything. Is there a requirement that it not be done on the server (perhaps some of your clients could be in areas of low bandwidth or you are concerned about traffic and want to take a load off the server). Anybody who advises you in any way without examining your requirements is selling you snake oil.

Brian Newman

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.