Partager via


CSS vs XSL

Last Week Xml.com posted an article by HakonWium Lie and Michael Day called "Printing XML: Why CSS is Better than XSL".  It was a pretty good read on why, for printing and web page rendering purposes, CSS is better than XSLT.  The authors are careful to point out that XSL's functionallity is far more robust than CSS and is better for a variety of uses, but that for printing, CSS may be the better alternative.  As a XML guys and a  blogger who has grand ideas that he might be able to design a cool-looking blog one day, rather than use one of the various standard templates available to me, I've often thought that XSL would be a great way to format a blog, with an XML data model benieth.

It strikes me that none of the bigger blogging engines seem to use XML for anything more than publishing their RSS/ATOM feeds.  It seems that there are some nice bonuses for using an XML data model as the core of a blogging system:

  1. All blogs publish feeds in XML format already, if it was the data model, the manipulation to generate the feeds would be less.  In fact, using RSS or ATOM as the data model, subscribers could create highly customized feeds by giving an XPath to the blogging system that would generate the feed for them.
  2. XSL would provide a nice, standard way to do templating to create pages.  Most / all blogging systems provide a way for users to customize the looks of their blog.  But each one does it differently in their own special way.  Why?  It seems like a standard way to do templating is the answer.  Though I must admit that XSL is probably not the easiest language to pick up for the average blogger.
  3. Information sharing on the web is done as XML, so integrating other data into your blog should be easier.  Many blogging systems include components which grab information from other websites, perhaps through RSS or Web Services.  Either the specific component that does that also renders the information, or it imports the information into the blog's data format before rendering.  If the data model were XML, there would be less work to be done.
  4. XML can be an offline data store, or can be stored within SQL Server for online data storage.  Being the SqlXml guy, I had to mention this one.  A few blogging systems offer the ability to work against a database or against flat files on the system.  This could easily be accomplished using XML.  Have the blog work against and in-memory XML document.  When the document is loaded or saved, it either goes to the file system, or through SqlXml to the database, or to any other sources that could send and receive XML data, perhaps ove Web Services.  The details of how the data is stored is now abstracted away from how the data is worked with.  Users could even, if they were so inclined, write their own XML<->Data store conversions to store the blog in any data storage system.

This is actually a project I've though about making an attempt at.  Perhaps now is the time to give it a shot and see what the results are.  Who knows, maybe I'll even be able to use it and my knowledge of XSL to create a decent interface, not an easy task for a database guy.

Or maybe I should jsut go learn more about CSS.

Irwin Dolobowsky
SqlXml PM
MSDN XML Dev Center Content Strategist

Comments