Log in

View Full Version : Xslt


WetWired
2007-10-22, 11:17 AM
I started using XSLT (http://www.w3.org/TR/xslt) recently, and it's pretty crazy. XSLT is a client-side web templating system that allows you to send a web page as raw XML data and then the XSLT stylesheet converts it into the actual HTML web page. This means bandwidth savings, since the stylesheet only gets transfered once, then you just send the different data; you can use elements liberally since they aren't transfered in every page load. Beside that, XSLT is the most powerful templating language I've ever used. I can send XML data on a table format, then refer to it as I walk through the data to determine how to format the data, for example. You can sort data within the template system, so instead of doing a page load to sort, you can have the template run over the data one time for each way to sort it, then use JS to hide and show them according to how the user wants the data sorted, and you only had to send the data once. XSLT is supported by nearly all of the prominant web browsers.

Anyone else play with it any?

Lenny
2007-10-22, 11:48 AM
I never have, but I think I will. Sounds very interesting.

Is it only the stylesheet that is coded as an XML file?

WetWired
2007-10-22, 06:05 PM
I'm not sure I understand.

Lenny
2007-10-23, 04:41 AM
Sorry, I'll try and make myself a bit clearer.

In fact, "How, exactly, does XSLT work?", is the simplest thing to ask. :p

WetWired
2007-10-23, 07:22 AM
You link in an XSLT stylesheet at the top of your XML document. The XSLT stylesheet defines a transformation that turns the XML document into an HTML document. If you go to w3schools.com, they have a pretty good introduction, though none of their stuff on anything goes into much depth.