To start with a disclaimer : I am not hindered with much of practical XSLT experience. Mainly a matter of taste. But the technique keeps popping up over and over again. Every book on XML does cover it, there's a component sitting on VS.NET toolbox and a lot of MS apps do use XSLT in some kind of way. More on that later. XSLT is confusing to me because it does mix data and code. Code which was originally meant to format the presentation of the data but can be used to do whatever what. In .net you can even call methods of your own assemblies in an XSLT transform. I do like XML, it gives you a great insight how your data is structured and what it is supposed to stand for.
A part of the talks by master Don on Indigo were on the separation of code and data. An object encapsulates data and has behavior in the form of methods. A message does not have any behavior. An object is a very nice thing to use inside your code as long as it stays in there. A message can be presented to the outer world. That is a clear story separating the two. I understand the sub-title of Don's blog as not to friendly on XSLT either, but maybe it is an over-simplification to lump these two matters. To keep on over-simplifying let's take a small look at XAML. In XAML you can store code in a CDATA section of a XAML file describing a component. Again you are mixing code and data then. Brent Rector takes a very strong stand against doing this in the Longhorn book. But even Don published a snippet where he did mix.
After these theoretical thoughts (flame me out of here if it is bullshit) the actual reason for this post. I bumped into XSLT again where it tried to to something behind the scenes, didn't know how to solve that and presented me with something which had me puzzled for quite some time. Internet Explorer uses XSLT without us noticing it. The result is quite nice when you open an XML file in IE, but the result is a horror when you try to open an aspx file via a local path, not via http. The main menu of an app I'm working on is a plain index.htm, I use Frontpage to try to make it look pretty and use plain hyperlinks to the aspx pages. Works like a snap until you open the file locally. It folllows the link and will try to open the aspx. There is no IIS between the request and the file and what happens is that IE tries to perform a transform and fails.
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
A name was started with an invalid character. Error processing resource 'file:///C:/Usr/SU/MOC 1.0/Systeembeheer/Menu.aspx'. Line 1, Position 2
<%@ Page language="c#" Codebehind="Menu.aspx.cs" AutoEventWireup="false" Inherits="Systeembeheer.Menu" %>
-^
I don't blame my local disk for not acting as a an IIS, I do blame IE for this stupid message. A little Googling showed me this does happen in a lot of other scenarios as well. Leaving a lot of people puzzled. And it is a code and data mix-up. But the code was not intended for XSLT but for the ASP.NET web-server.
Blog on,
Peter