May 30, 2007

Smart trick - exslt:node-set() in Internet Explorer

I found this gem in David Carlisle's blog. Smart Javascript trick allows to mask msxsl:node-set() extension function as exsl:node-set() and so you can easily write crossbrowser XSLT stylesheets using exsl:node-set() functionality. Opera 9, Internet Explorer 6-7 and Firefox 3 are covered, but sadly Firefox 2 is out of the game. Julian Reschke came with a nice trick using Javascript expressiveness:

  exclude-result-prefixes="exslt msxsl">

<msxsl:script language="JScript" implements-prefix="exslt">
 this['node-set'] =  function (x) {
  return x;

Very smart.

That reminds me old days of mine when I came with a similar trick for EXSLT extension functions implemented in C# (for EXSLT.NET project). Except that C# isn't so dynamic as Javascript so I had to escape to renaming method names in MSIL bytecode. That trick still drives EXSLT.NET (now module of the Mvp.Xml library).

 By the way just to remind you - .NET (XslCompiledTransform) supports exsl:node-set() function natively.

May 27, 2007

IronXSLT: Changing the Way You Work with XSLT in Visual Studio

Yes, I'm trying to change the way you work with XSLT in Microsoft Visual Studio. It must be a pleasure to develop and rocket fast at runtime. Yes, Visual Studio already supports editing, running and even debugging XSLT, but it's still a painfully limited support. So I'm started building IronXSLT - Visual Studio plugin aimed to provide total integration of the XSLT language in Visual Studio IDE.

Current list of planned and already implemented IronXSLT features includes:

  1. XSLT Library Project (Visual Studio project type for compiling XSLT into DLL)
  2. XSLT Refactorings
  3. Multiple XSLT engines
  4. XSLT Profiler
  5. Extensive library of XSLT code snippets
  6. XPath Intellisense
  7. Visual XSLT builder
  8. XSLT2XLinq and XLinq2XSLT converters

IronXSLT version 0.1 implements first point.

IronXSLT supports only forthcoming Microsoft Visual Studio version, codenamed "Orcas", which is about to be released later this year. That also makes IronXSLT ship date.

IronXSLT is free for personal and commercial usage, but not open source currently.

Download IronXSLTIf you happens to have Visual Studio Code Name “Orcas” Beta 1 installed,  you can give IronXSLT version 0.1 a shot.

Needless to say, any comments, bug reports and feature requests are greatly appreciated on the IronXSLT Forum.

I decided not to call it Visual XSLT to avoid confusion with ActiveState Visual XSLT plugin, which was discontinued back in 2005, but still might be trademarked. And as I was obviously copying a lot from the IronPython integration sample in Visual Studio SDK, IronXSLT name became a natural choice.  I like this name.

Here are go some screenshots and information about IronXSLT.

You know, just run the installer. Once installed, IronXSLT adds itself into a list of installed products appearing on the Visual Studio splash and About dialogs:

Visual Studio Splash


Note: if you have lots of Visual Studio plugins installed, IronXSLT may not appear in the splash dialog, because of lack of the screen estate.


Visual Studio About Dialog


XSLT Library Project

IronXSLT adds "XSLT Library" to the list of Visual Studio project types:

XSLT Library Project Properties

XSLT Library project allows to compile XSLT stylesheets into DLL. Each XSLT stylesheets becomes a class in the DLL and can be loaded and run later using standard XslCompiledTransform class. This way you can avoiding paying XSLT compilation tax at runtime.
XSLT Library project has the following properties:

  • Assembly Name - name of the resulting DLL
  • Default Namespace - target default namespace for compiled XSLT stylesheets

XSLT Library Project Properties

Build XSLT Library project as usual. If there are any compilation error, they will appear in the Error List window, again as usual.


Building XSLT Library Project


May 15, 2007

Compiled XSLT decompiler?

I was reading Scott's post on Reflector Addins and had this idea... Now (well, not now but in the next .NET version - Orcas) that XSLT can be compiled into dll, it must be time to think about XSLT decompiler (and appropriate Reflector addin of course). I believe that must be feasible. Would it be useful for you?

May 9, 2007

Couple teasers on my next toy

To be continued...

Free Refactor! for ASP.NET 2.0

Mark Miller announced Refactor! for ASP.NET v2.2 - free code refactoring tool from Developer Express. It includes 29 refactorings, including 10 ASP.NET related ones and is available for Visual Studio 2005 and Visual Studio Orcas Beta1.

ASP.NET refactorings include:

  1. Add Validator
  2. Extract ContentPlaceHolder
  3. Extract ContentPlaceHolder (and create master page)
  4. Extract Style (Class)
  5. Extract Style (id)
  6. Extract to UserControl
  7. Move Style Attributes to CSS
  8. Move to Code-behind
  9. Rename Style
  10. Surround with Update Panel

This is awesome tool and it saves me LOTS of time (I'm using Refactor! Pro).

My favorites so far:

Those lucky like me having Refactor! Pro - don't install Refactor! for ASP.NET, instead update your Refactor! Pro installation.

May 6, 2007

AdSense Watch Toolbar 1.0.1 - supports Google Accounts

 Google has started to migrate AdSense users to Google Accounts and it broke my little  AdSense Watch Toolbar - it couldn't login into account. For the first time and only because I haven't coded login procedure flexible enough. The change was oneliner - just different URL.

Anyway, I uploaded AdSense Watch Toolbar v1.0.1, which supports both old AdSense and new Google Accounts. If you migrated to Google Accounts, please update.

May 1, 2007

Where is eBook 2.0 aka AJAXy PDF?

Do you realize that PDF documents can contain embedded Javascript code? Yes, it can. Adobe Acrobat Reader supports Javascript 1.5 extended by Adobe and it allows such sweet things as dynamic PDF content and appearance manipulation, database-driven PDF documents, multimedia, layers, 3D, Flash in PDF (!) etc.

We've seen fancy PDF documents with animations, lame PDF calculators, but where is the real beef? Where is Web2-like stuff, where are AJAXy PDF eBooks?

The platform appears to be strong enough, the Adobe Acrobat Reader market penetration must be huge, so why smart eBooks still nowhere to be seen? I can imagine lots of opportunities:

Autcomplete search field prepopulated with index words? That would improve search in huge documents, which is still a nightmare despite all Adobe efforts

Dynamic context ads in eBooks? Many would hate it, but authors and publishers would appreciate such revenue stream. Say, small text-based context ad on every 5th page wouldn't harm much. After all unlike Web pages eBooks usually have lots the real content so it must be easy to produce really well targeted context ads.

Social features in eBooks? That might be huge. eBook readers form natural social community, which is currently completely hidden. "Recent readers" sidebar, annotations, ratings, comments, chatting, "Digg this book"?

Autoupdating eBooks? "New book edition is published, get it here" or even "Book updates available, download?". Why not?

These are just few the most obvious ideas. Sure you can come up with more.