admin管理员组文章数量:1241160
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?
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?
Share Improve this question asked Dec 31, 2008 at 14:26 jrutterjrutter 3,21310 gold badges45 silver badges51 bronze badges 2- 1 Is the XSL transformation happening server side or client side? – Alohci Commented Dec 31, 2008 at 14:34
- Without plete use case this will get a lot of subjective answers. – user357812 Commented Apr 29, 2011 at 22:05
6 Answers
Reset to default 4Are 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 pressed 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.
I would definetly agree with a previous mentor 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./quickref/
hope this helps...
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.
Create the XSLT Macro that generates the HTML
Place the XSLT Macro in a blank page
Call page with AJAX
Replace the existing HTML content
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. 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 remend that you check out: JQuery, Prototype, and Dojo
I think JQuery is the best but I will leave that determination up to you.
I've used this technique extensively, both on client and server side. My experience has been that it performs adequately in most scenarios (but then I'm contrasting its server-side performance with VBScript in ASP pages).
Where performance is an issue, it's very important to take XML parsing and XSLT pilation out of the operation wherever possible. If you have a client-side method that uses XSLT to dynamically render an element in the page, make sure it's not loading and piling the XSLT every time it's called. If you're using server-side XSLT, cache the XSLT processor object in whatever collection your server environment supports.
You can get significantly better client-side performance by using Javascript and JSON instead of XML and XSLT. I haven't benchmarked it, but I'd bet that the biggest performance gain es out of the fact that parsing JSON is much less CPU-intensive than parsing XML.
Try using tox as an example. There isn't a tutorial, but if you take a look at the example provided, it is well mented and includes AJAX.
本文标签: javascriptWill XSLT work well with AJAXStack Overflow
版权声明:本文标题:javascript - Will XSLT work well with AJAX? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1740043138a2221787.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论