CSS isn't just for HTML anymore! Learn to combine the strengths of CSS with those of XSLT and fine-tune your XML presentation in a browser.
In parts 1 and 2 of this tutorial series, Uche Ogbuji has shown how to use Cascading Stylesheets (CSS) to display XML in browsers, presenting basic and advanced techniques. Although some people see XSLT and CSS as opposing technologies, they are actually very complementary. CSS cannot, and is not designed to, handle many XML rendering tasks. You can use XSLT for many such tasks, and even manage the CSS that is still used to fine-tune the presentation. This tutorial covers techniques for using XSLT to process XML in association with CSS.
Anyone who works with XML should take this tutorial. Even if CSS and XSLT don't cover your needs for production Web publishing, they are great tools for general processing, debugging, and experimentation. They offer rich interaction with other XML technologies and you'll be likely to run into CSS and XSLT even when you least expect them.
This tutorial, third in a series, discusses XSLT techniques for working with CSS for HTML or XML output. The approach very step-by-step, and includes many examples (including expected display in Firefox).
If you're wanting to get more of a background learning how to use CSS with XML, see the previous tutorials in the series:
- "Use Cascading Stylesheets to display XML, Part 1" which introduces the use of CSS to style XML in browsers (November 2004)
- "Use Cascading Stylesheets to display XML, Part 2" which covers advanced topics for the use of CSS to style XML in browsers (February 2005)
The response has been very positive to the first two. Here is what has been posted through the feedback form according to my editor:
"Use CSS to display XML, Part 1"
Average rating: 4.03 (out of 5.00)
Responses received: 33
"Excellent concise overview. Thanks."
"very nice presentation of the fundamentals with excellent examples"
"Good introduction. Needs a more dramatic example."
"Nicely done thanks .."
"Only had a quick read this time but I'm sure a full going over will improve my XML/CSS skills no end!"
"Hi:After several weeks of reading several books and posting to several list, you very simply provided me with an answer to my very simple question, which was "How can I present xml data using css?"Thanks."
"I already use CSS but this tutorial taught me some new tricks on generating content with CSS."
"Use CSS to display XML, Part 2"
Average rating: 4.00 (out of 5.00)
Responses received: 9