XML

Summary

Style sheets represent an important technological innovation with respect to the Web because they make it possible to exert exacting control over the appearance of content in both HTML and XML documents. Style sheets allow markup languages such as HTML and other custom XML-based languages to focus on their primary jobstructuring data according to its meaning. With a clean separation between content and presentation, documents coded in HTML and XML are better organized and more easily managed.

This tutorial introduced you to the basics of style sheets, including the three main style sheet technologies that are applicable to XML: CSS, XSLT, and XSL-FO. Although these technologies all solve similar problems, they are very different technologies with unique pros and cons. Although you learned the fundamentals of how and when to use each type of style sheet, the remaining tutorials paint a much clearer picture of what can be done in the way of styling XML data with CSS, XSLT, and XSL-FO style sheets.

Q&A

Why is it so important to separate the presentation of a document from its content?

It's been proven time and again that mixing data with its presentation severely hampers the structure and organization of the data because it becomes very difficult to draw a line between what is content and what is presentation. For example, it is currently difficult for search engines to extract meaningful information about web pages because most HTML documents are concerned solely with how information is to be displayed. If those documents were coded according to meaning, as opposed to worrying so much about presentation, the Web and its search engines would be much smarter. Of course, we all care about how information looks, especially on the Web, so no one ever said to do away with presentation. The idea is to make a clean separation between content and presentation so that both of them can be more easily managed. A good example of how this concept is being applied to a very practical web service is Yahoo!'s Flickr online photo service (http://www.flickr.com/), which allows you to associate keywords with photographs that you post online. As more and more people add context to their photographs via keywords, it will be increasingly possible to search the Web for the content of photographs, which is something previously impossible. With photographs, the content is inherently linked with the presentation but keywords allow you to tack on additional information about the content.

What does it mean to state that XSL-FO is a superset of CSS?

When I say that XSL-FO is a superset of CSS, I mean that XSL-FO encompasses the functionality of CSS and also goes far beyond CSS. In other words, XSL-FO is designed to support the features of CSS along with many new features of its own. The idea behind this approach is to provide a smooth migration path between CSS and XSL-FO because XSL-FO inherently supports CSS features.

by BrainBellupdated
Advertisement: