CSS vs. XSL

Line Separator

Styling-based vs. transformation-based processing model

Cascading Style Sheets (CSS) and Extensible Stylesheet Language (XSL) are two different style languages recommended by the World Wide Web Consortium (W3C). Although they use completely different processing models and syntax, they have one important similarity: both support a page layout model based on automatic pagination, and therefore can be used to print XML documents or Web content.

CSS as well as XSL are suitable for printing a great variety of business documents, book-style documents and other documents that include arbitrary quantity of flowing text which must be divided over multiple pages. However, they are less suitable for highly graphical and complex layout-driven documents (e.g. magazines, catalogs and newspapers), in which the multifaceted layout of each page usually requires manual intervention.

Both CSS and XSL can be used for various printing tasks. Pros and cons have been widely discussed. Which one should you use to print XML documents or Web content? According to W3C the rule can be summarized very succinctly:

 

Use CSS when you can, use XSL when you must!

 

In particular cases XSL might be necessary to achieve a very sophisticated layout, but for the majority of documents printed or streamed over the Web CSS is the superior choice. The benefits of CSS are obvious:

  • Very clean and understandable markup
  • Widely used and very popular on the Web
  • Much easier to use, easier to learn, thus easier to maintain
  • No need to master the complexities of XSL-FO syntax, programming and transformation
  • Multi-channel publishing (e.g. Web and Print) only requires the knowledge of one style language
  • Use simple declarative rules that specify the desired style and layout
  • Simple, styling-based approach that does not require advanced programming skills
  • Designers with no programming background can produce printed output quickly and efficiently
  • Reduce integration, deployment and maintenance costs
  • Increase the productivity of your designers

CSS's simplicity means it has its limitations. Some things you cannot do with CSS, or with CSS alone. For example: to calculate the total etc. within an invoice or billing statement. Then you need XSL, or at least XSLT, the transformation language/part of XSL. Therefore, PDFreactor comes with built-in support for XSLT processing that offers further flexibility and interoperability for those who need to include a XSLT style sheet on top.

Download

Download the latest PDFreactor version. Choose the installation package for your operating system.  more

What's new

RealObjects PDFreactor 5 offers even more exciting features and better performance. The highlights of the new version include... more

Case Studies

We invite you to review our customer case studies to find out how our solutions have helped others optimize user productivity.  more

Buy / Upgrade

Already convinced? Buy PDFreactor or upgrade to the latest PDFreactor version. more

Copyright © 2000-2012 RealObjects GmbH
Bookmark this on Delicious Slashdot it