XML Stylesheets

From the previous article, you know that XML does not have any implicit style information. One way to display formatted document is using the XHTML page. It seems alright, but does not provide full-fledged. styling for XML documents.

We solve this problem by using an external stylesheet , just for the style and transformation of XML documents, tags and elements. In this way, we ensure that the style information is kept separately than the data within XML.

Different Types of Stylesheets

There are different types of stylesheets to style web pages. Here is a list for you.

  1. Cascading Style Sheet (CSS)
  2. Extensible Stylesheet Language (XSL)
  3. Document Style Semantics and Specification Language (DSSSL)
  4. Formatting Output Specification Instance(FOSI)
  5. Proprietary Stylesheet Languages (PSL)

I will try to give brief description for each of these.

Cascading Stylesheet (CSS )

The cascading stylesheet is lightweight and simple, easy to learn stylesheet language. It is more popular in the HTML space. All web browser implement some sort of CSS all the time, with slight variation.

No browser can fully support the CSS standards and it keep changing. While CSS get good job in rendering webpages, it is not a sophisticated system, then printing systems, that use CMYK or Pantone colors schemes. CSS get most of the colors through RGB or HSL schemes.

Current CSS standard is CSS3. To learn CSS, go to CSS tutorial.

Extensible Stylesheet Language (XSL)

XSL is the stylesheet for XML documents. It does not work like CSS which attach the style information to the elements. Instead, XSL is a programming language with templates, functions, and recursion, its quality of style is far better than CSS, but the complexity keeps it away from becoming popular.

Other stylesheets are for both SGML and XML both except the Proprietary Stylesheet Language(PSL)

that want to customize the styling experience. The goal is not using the style information on lot of products and wherever it is used produce high quality results.