Manage Learn to apply best practices and optimize your operations.

I spy on XML!

Comparison of CSS and XSLT approaches for rendering XML-based files.


I spy on XML!
Ed Tittel

OK, I admit it -- I'm deep into revising my book XML For Dummies into its 3rd edition right now -- and it's got me pretty focused on a broad overview of the whole subject matter. I've found myself faced with the need to put XML documents (or as my tech editor for the book tells me I should say "XML-based documents") onto a CD in some meaningful way that lets the content look like something more than a "View source" listing of some vaguely HTML-like markup language.

To that end, I'm in the process of crafting cascading style sheet (CSS) documents for direct viewing of numerous example files, along with some XSLT transforms to use with the Apache Xerces C++ XSLT processor to turn those same examples into HTML for easy browser viewing. "Why not go one way or the other?" you ask. Well, I feel compelled to compare and contrast these two ways of delivering XML documents to a Web browser for good or ill.

In the process, I'm able to observe once again how different and unpredictable CSS support for XML can be, even in mainstream browsers like Internet Explorer 5.5 and 6.0 as well as Netscape Navigator 6.2. In fact, the same is true for other browsers that are supposed to be more "standards-friendly" as well, such as Amaya and Opera. Although CSS is explicitly designed to manage how markup looks inside a Web browser, what's predictable and almost inevitable for CSS and HTML doesn't share those characteristics for CSS and XML -- at least, not yet.

Although writing XSLT transforms to grab XML document elements and convert them into pleasing HTML equivalents (with or without matching CSS style sheets) is more work, the results are much more predictable and often, easier on the eyes. Although a vast world of XML data and documents already resides on many servers, and many more organizations are in the throes of converting their data and documents to XML, Web browsers don't seem as ready to ingest and display native XML documents with the same alacrity and aplomb that they show for HTML. I guess we'll have to wait a while yet, and hope for the best!

What I did discover on this path to providing viewable XML for the book was that the XMLSpy Suite, version 4.2, is one heck of a wonderful instrument for working with (and even viewing) XML documents, XML Schemas, XSLT, CSS, and a whole bunch more. The suite is a veritable Swiss Army Knife of XML functionality with lots of strong features and functions, well worth getting to know. At $399 it's not exactly cheap, but it does offer an excellent environment in which to design XML documents and to create, manage, and display XML-based content. You can grab a free 30-day eval copy from the company's Web site at I don't normally plug specific products, but this one is worth a once-over for anybody who's serious about working with XML and who doesn't already have the tool angle totally covered.

Have questions, comments, or feedback about this or other XML-related topics? Please e-mail me care of; I'm always glad to hear from my readers.

Mention of a specific product in this tip does not imply endorsement of the product by searchWebservices or Techtarget.

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 (including XML and XHTML), plus various IT certifications (Microsoft, Sun/Java, and Prosoft/CIW).

Dig Deeper on Topics Archive

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.