Buzzword Buster — Stylesheets, XSL and XSLT


A Stylesheet lan­guage or style lan­guage, is a com­put­er lan­guage used to describe the pre­sen­ta­tion of struc­tured doc­u­ments. A struc­tured doc­u­ment which doesn’t break the schema it is designed to con­form to is “well-formed”.

One mod­ern Stylesheet lan­guage with wide­spread use is Cas­cad­ing Style Sheets (CSS), which is used to style doc­u­ments writ­ten in HTML, XHTML, SVG, XUL, and oth­er markup lan­guages. One of the most attrac­tive fea­tures of struc­tured doc­u­ments is that the con­tent can be reused in many con­texts and pre­sent­ed in var­i­ous ways. Dif­fer­ent Stylesheets can be attached to the log­i­cal struc­ture to pro­duce dif­fer­ent pre­sen­ta­tions.

In order for con­tent in struc­tured doc­u­ments to be pre­sent­ed, a set of styl­is­tic rules — e.g. colours, fonts, lay­out — must be applied. A col­lec­tion of styl­is­tic rules is called a Stylesheet.


XSL stands for EXten­si­ble Stylesheet Language.

CSS = Stylesheets for HTML — HTML uses pre­de­fined, well under­stood tags, you can use CSS to tell a brows­er to dis­play an ele­ment in a spe­cial font or colour, etc.

XSL = Stylesheets for XML — XML does not use pre­de­fined tags and there­fore the mean­ing of each tag is not well under­stood. XSL describes how the XML doc­u­ment should be dis­played!

XSL con­sists of 3 parts:

  • XSLT — a lan­guage for trans­form­ing XML doc­u­ments
  • XPath — a lan­guage for nav­i­gat­ing in XML doc­u­ments
  • XSL-FO — a lan­guage for for­mat­ting XML doc­u­ments


XSLT stands for XSL Trans­for­ma­tions, it is a declar­a­tive, XML-based lan­guage used for the trans­for­ma­tion of XML doc­u­ments into oth­er XML doc­u­ments.

The orig­i­nal doc­u­ment is unchanged, after the trans­for­ma­tion the new doc­u­ment maybe seri­alised by the proces­sor in stan­dard XML syn­tax or in anoth­er for­mat such as HTML or plain text.

With XSLT you can add/remove ele­ments and attrib­ut­es to or from the out­put file. You can also rearrange and sort ele­ments, per­form tests and make deci­sions about which ele­ments to hide and dis­play, and a lot more.

A com­mon way to describe the trans­for­ma­tion process is to say that XSLT trans­forms an XML source-tree into an XML result-tree.

XSLT uses Xpath to find infor­ma­tion in an XML doc­u­ment. Xpath is used to nav­i­gate through ele­ments and attrib­ut­es in XML doc­u­ments.

In the trans­for­ma­tion process, XSLT uses Xpath to define parts of the source doc­u­ment that should match one or more pre­de­fined tem­plates. When a match is found, XSLT trans­form the match­ing part of the source doc­u­ment into the result doc­u­ment.

Further reading:

W3C schools XSLT Tuto­r­i­al