XSL Transformation Sheets Versus CSS Style Sheets

Previous Next

See Also

You can define cascading style sheets (CSS) to add style (e.g. fonts, colors, spacing) to web pages. You can add XSL transformation rules to influence the behavior, the layout, and presentation aspects of web pages. In some cases, you can use both technologies to reach your target.

Which one should you use? Basically, the rule can be summarized this way: Use CSS when you can, use XSL when you must. The reason being that in general, CSS is easier to use, easier to learn, easier to maintain and cheaper. There are WYSIWYG editors for working with CSS and in general there are more tools for CSS than for XSL. But CSS's simplicity means it has its limitations. Some things you cannot do with CSS, or with CSS alone. Then you may need to use XSL transformations.

The unique features are that CSS can be used to style HTML documents. XSL, on the other hand, is able to transform documents. For example, XSL can be used to transform XML data into HTML documents on the Web server. This way, the two languages complement each other and can be used together.

Just as with CSS, XSL transformation sheets cascade; more than one transformation sheet can transform and change an XML document. The default XSL transformations are taken from the USApplet.xsl transformation sheet in the <Web Publication>\xsl folder. In addition, you can add your own transformation rules using your own transformation sheets.