James 的个人资料James's Space照片日志网络更多 工具 帮助

日志


10月31日

XSLTX v1 available

I've spent the last two days tidying up my 'XSLTX' framework for using xslt with embedded server controls, postback event handling etc. which I originally mentioned in my previous blog entry.
 
A 'v1' release of the framework is up on the web and you can download it at http://www.tesl.com/NR/rdonlyres/10DFD5E6-2D28-4F8B-A468-AA71E85A1684/0/TrinityXsltx.zip.  It's an installer which will do the following:
  • Copy the Trinity.Xsltx.dll assembly and accompanying CHM file into c:\Program Files\Trinity Expert Systems\Trinity.Xsltx.
  • Copies two sample projects and a solution file into c:\Program Files\Trinity Expert Systems\Samples.
  • Copy the Trinity.Xsltx.dll assembly into the GAC.
  • Backup and modify C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.CSharp.targets to add a build task into the C# compilation process.  If you don't want this, just copy the backup back over the modified version.
  • Backup and modify C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config to add support for the new build provider and handler factory.  Again, if you don't want this, just copy the backup back over the modified version.

Uninstalling from add/remove programs will undo all the above steps - with the config files it re-edits them to remove the relevant entries rather than just copying the backup back over the modified file, so if you (or Microsoft) make any further changes after installing this framework and then uninstall, you won't lose them.

I'm not going to blog extensively today about how to use it - the samples and CHM file should be enough to start having a play.  Let me know if there's any problems, with the installer or otherwise, and I'll try and sort them out.

Have fun!

10月29日

XSLT, ASP.NET Server Controls and ASP.NET 2 Build Providers

I don't get to do much development any more - too many solutions to design, bids to respond to and difficult projects to sort out.  But sometimes I get bored with all that and long for the fun life of .NET development .  And then sometimes I even have some spare time to go with that urge and get round to indulging myself...
 
That's pretty much what happened last Christmas, when work wound down temporarily for a couple of days.  I'd just been reading about ASP.NET 2 build providers at the time and it made me think about a long standing desire of mine: to merge the ease of data postback and event handling that you get with server controls with the elegance of XML data rendering that XSLT gives you.  I've always loved XSLT (sure if you're used to imperative API based programming it takes a while to get used to the more declarative approach of XSLT) because I find for most non-trivial XML transformations it is more concise and much more readable and maintainable than .NET code.  Even with a complex XSLT it's quick to work out what the target output is going to look like.  Contrast that with relatively simple XML processing written using XmlDocuments/XmlTextReaders + XmlTextWriters (etc.) and personally for me it's 'no contest'.
 
Of course with what you get out of the box today, using XSLT to produce forms that will postback data, and then handle that on the server, is a pain in the neck that quickly puts you off touching XSLT in those scenarios.  Solving this problem by giving XSLT developers the same control capabilities as ASPX developers is something I long for - if this worked and your data is in XML then this should be the only thing you'd use - far more appropriate than ASPX.  I'm sure someone will argue with me about that - a good discussion to have :).  Basically though my interpretation of XSLT + Server controls + postbacks makes it pretty much an improved superset of ASPX so I don't see that as a controversial statement.
 
There's lots of ways you could start to do that in ASP.NET 1.1 and much of the problem is the same.  Build Providers just add some new possibilities and makes adding processing of new file types into the ASP.NET build process much easier.  MSBuild potentially gives similar new opportunities for non-web projects as well (e.g. controls libraries).  Another great advantage of .NET 2 is partial classes - it makes any such solution of declarative UI + code-behind much neater.  Enthused by my new knowledge I set out to create the answer I wanted... XSLTX!   Yes that's right - XSLT with server controls, event wireup and codebehind!
 
This was, as I mentioned, 11 months ago... I finished a draft working solution in a couple of days but was too busy to fully test it and soon got busy again.  Since getting this space (mostly, I admit, to have somewhere to put my photos) I figured I might as well put a little effort into blogging stuff like that because otherwise it'll get lost and not used.  Maybe, just maybe, someone will find it useful.  Anyway, I'm going to tidy it up a bit and put it on gotdotnet or similar and then blog a bit more on what I've done and how to use it.  What I'd really like to do is use VS extensibility features to make the developer experience much more seamless and feel like working with ASPX but that's a project for another week .
 
I should mention that I'm not the only one to have had thoughts along these lines (though I didn't know that till today, when I bothered looking...).  Have a look at the article Creating Dynamic ASP.NET Server Controls Using XML - it's not quite the same as what I've done but it's similar in concept, though on .NET 1.1.  Back with .NET 1.1 XSLT was also significanly slower (XsltTransform has now been replaced by XsltCompiledTransform)... so maybe this is an idea who's time has come.
10月27日

Photo's ahoy!

Well, I thought I might as well start uploading some photos because otherwise I never get around to sending them to anyone - now I can put them in one place and it's everyone else's problem to get hold of them .  Some of these will probably make you laugh and I haven't checked them too closely - but hey what's the point of photos without the stupid ones .