Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will XSLT work well with AJAX?

This might be a stupid or obvious question, but our whole site is rendered using XSLT to transform xml which is created on the fly from database queries and other pieces. Im starting to push a lot of ajax into the site to make it more dynamic, is there a good tutorial on xslt and ajax?

like image 305
jrutter Avatar asked Dec 31 '08 14:12

jrutter


4 Answers

Are you using XSLT on the server or in the browsers?

Modern browsers now have support for XML transformations from within the browser, one way is using AJAX to fetch the XML along with its stylesheet. You can then offload the processing of stylesheets to the clients machines. Be sure to cache the stylesheet and perhaps even send compressed XML.

The coding should be straight forward if you already know how to do AJAX. I worked on a system like this 5 years ago and it is a viable way to go.

like image 57
BeWarned Avatar answered Nov 19 '22 02:11

BeWarned


I would definetly agree with a previous commentor who shuddered at the thought of XSLT doing your heavy lifting. That is not going to be all that performant. Don't get me wrong, I like XSL a lot, but ...

Not as much of a tutorial, but the folks at Mulberry Tech (no idea what they do, or who they are) maintain a series of Quick Reference Guides for XSLT (and plenty others) that I find invaluable.

http://www.mulberrytech.com/quickref/

hope this helps...

like image 36
Todd Friedlich Avatar answered Nov 19 '22 02:11

Todd Friedlich


I think most of the answers are missing what the OP is asking for. I think the OP is asking if there is a way to get the XSLT generated HTML using AJAX.

I am taking this approach on Umbraco.

  1. Create the XSLT Macro that generates the HTML

  2. Place the XSLT Macro in a blank page

  3. Call page with AJAX

  4. Replace the existing HTML content

like image 2
Deepfreezed Avatar answered Nov 19 '22 01:11

Deepfreezed


our whole site is rendered using XSLT to transform xml

That thought makes me shudder. I've worked on two sites that have used XSLT to do heavy lifting in dynamically producing frequently accessed pages, and in both cases it required more development effort and CPU time per access than it was worth.

Irregardless, www.w3schools.com has plenty of good tutorials on many web technologies. They even have tests.

If you want to do AJAX while maintaining support for multiple web browsers I would strongly recommend that you check out: JQuery, Prototype, and Dojo

I think JQuery is the best but I will leave that determination up to you.

like image 1
Bernard Igiri Avatar answered Nov 19 '22 02:11

Bernard Igiri