Manage Learn to apply best practices and optimize your operations.

The Importance of CSS to XML

Although work underway on the formatting objects side of the Extensible Style Language (XSL) specification will someday change the content of this tip, today CSS is the only game in town when it comes to managing the appearance of XML documents for display on the Web.

CSS, of course, stands for Cascading Style Sheets, and is a markup language that can be used inline in HTML or XML documents, or in external style sheet documents (of type text/css) to define how HTML or XML elements and their contents should appear in a document.

When it comes to CSS, as with other forms of markup, there's a lot to learn. So here are some of my favorite resources to help you come up to speed on this great presentation management tool, including books and online materials:

Bert Bos and Hekon Wium Lie of the W3C wrote the original CSS specification, and also wrote a book on the subject, along with Robert Caillau, called Cascading Style Sheets, 2nd edition (Addison-Wesley, Reading, MA, 1999. List Price: $39.95. ISBN: 0-201-59625-3.) A worthwhile overview of the specification and its capabilities, and a decent reference, but not as good as the other two books mentioned here, except for details about CSS's inner workings. Does not cover the precise details of including CSS in XML documents, however.

Erik A. Meyer wrote Cascading Style Sheets: The Definitive Guide (O'Reilly & Associates, Sebastopol, CA, 2000. List Price: $34.95. ISBN 1-56592-622-6.) as part of O'Reilly's outstanding Definitive Guide series. As such, it's a great reference and a wonderful source of examples of using CSS with HTML. Does not cover the precise details of including CSS in XML documents, either.

Frank Boumphrey, a friend and occasional co-author, wrote Professional Style Sheets for HTML and XML (Wrox, Birmingham, UK, 2000. List Price: $39.95. ISBN 1-861001-65-7) as part of Wrox's outstanding XML and Scripting series. Like many of the other books in this series, this book succeeds as both a tutorial and a reference. Unlike other books on CSS, however, it includes sufficient details for readers to understand how to use CSS with XML to manage rendering behavior in a Web browser. Highly recommended.

As a possible bonus, Frank Boumphrey also has a nice online CSS tutorial available for download on his Web site Unfortunately, it covers only HTML issues.

WebMonkey has a whole slew of style sheet information available on its Web site, including tutorial, details for working with IE5, testing Web browsers for CSS support, and much more, but primarily HTML focused. Check it out.

Todd Fahrner's got some great stuff on style and typographic controls for Web sites, and some outstanding rants and raves, most of which is well worth your reading effort.

Stuart Culshaw, Michael Leventhal, and Murray Maloney wrote a great piece for called "XML and CSS" that explains in detail how to use the two forms of markup together, and where potential pitfalls lie. Once you've got your hands around CSS, be sure to make this article part of your required reading.

With a CSS book or tutorial and a bit of study, you can learn the notation. With a bit more elbow grease and experimentation, you can test the benefits of CSS in bringing your XML content to the Web- assuming your Web browser knows what to do with such arcane stuff (be sure to check out Erik Meyer's Webmonkey article on (browser testing with CSS for that very reason).

Ed Tittel is a principal at LANWrights, Inc.: a wholly owned subsidiary of LANwrights offers training, writing and consulting services on Internet, networking, and Web topics, plus various IT certifications (Microsoft, Sun/Java, Prosoft/CIW).

Dig Deeper on Topics Archive

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.