W3C's style sheet language can make life easier for web designers

CSS and XSL help ensure consistent presentation of content.

What is it?

Style sheets are used to define the presentation of HTML, XHTML and XML (Hot Skills, 9 August). HTML contains presentation elements, but these are being stripped out of XHTML2, so style sheet skills will be needed.

The Worldwide Web Consortium (W3C) agrees the specifications for style sheets, which are then incorporated into browsers, authoring tools and other commercial and open source products. The W3C has two style sheet languages: Cascading Style Sheets (CSS), the best known, most widely implemented and easiest to learn, use and maintain; and Extensible Style Language (XSL). 

Where did it originate?

The W3C has promoted the use of style sheets on the web since it  was founded in 1994. Its Style Activity brought together a lot of existing work, particularly on the Standard Generalised Markup Language-based Document Style Semantics and Specification Language. Microsoft was involved heavily in the early development of XSL, providing  five of the 11 authors of the first  XSL proposal in 1997. 

What is it for?

Style sheets are standalone documents that can be embedded within one document, or applied to a number of documents - perhaps all the pages on a website.

They can be created by hand, using a simple text editor, or a language such as Ecmascript or Java, or using an authoring tool. Libraries of style sheet functions are available, and many are free - see the W3C CSS pages for links.

The W3C's advice is, "Use CSS when you can, use XSL when you must." CSS is simpler to work with and can also be used to style both HTML and XML documents, whereas XSL can only be used with XML. However, where transformations are involved, you need XSL; and XSL can transform XML data to HTML/CSS documents.

CSS and XSL use the same underlying formatting model. They complement one another and can be used together.

What makes it special?

Using external style sheets, you need only maintain a few to provide a consistent and easily updated presentation for all the documents on a website.

Embedded style sheets have to be edited individually. The style sheets are device- and browser-independent, further reducing the need for multiple implementations.

Website content can be ported easily , reducing the work and cost of upgrades to new platforms and minimising requirements to support new devices.  

How difficult is it to master?

XSL is straightforward for those who already know XML. Otherwise the W3C recommends finding a browser that supports CSS and experimenting. A list of suitable browsers can be found online.


Where is it used?

XSL, with its transformative power, is intended to be the presentation language of the future, used not only in web and XML document design, but also paper-based publishing, braille and even audio output.


Read more on IT jobs and recruitment