Wednesday, October 20, 2010

Tools I can’t imagine my dev life without #2: XSLT Debugger in Visual Studio

Hi,

While a lot of us .NET developers at some point in our life used XSLT, it was never easy. Of course our logic and XSLT syntax should help us to understand different things but that is not always the case. Probably because it’s almost always a black box abstraction.

In my last project we use a lot of XSLT for generating all kind of documents with all kind of restrictions and filtering, usually you have an XML document, you got an XSLT and a XslCompiledTransform object which you use to actually get your transformed document. But because of the thing that it is like a black box all you can do is sit back and hope you did well the XSLT thing and you’ll get needed document out of the box. At least this is what I thought until this week.

This week I needed to change one of my XSLT document templates, because I was getting a very strange error at document generation. I thought at this moment that I couldn’t do it without debugging and I was hoping that somewhere in the world existed a nice tool which could manage XSLT debugging and which would have at least a trial period. I googled “debug XSLT”, and guess what I found? This link which gave me the power I didn’t even imagined to have without having to install some third-party tools.

It is incorporated directly in Visual Studio !!! I tried it in VS 2008 and VS 2010, Visual Studio 2010 even got a profiler for XSLT, so you could measure your transformation sheets and make reports on that. Isn’t that great? Plus you got a lot of way to do debugging. And now some screenshots.

DebugXslt

1. While stylesheet open click on XML => Debug Xslt

ChooseXml

2. Choose input XML file

Debugging

3. Debug and actually see the magic ! In parallel you can see the output.

Same things could be done in VS 2010

Visual Studio 2010

And you automatically get the html output. Plus you can always see the source of html.

So get ready to a new era of XSLT debugging with all the tools you are used to: Locals, Watches, Immediate Window and others as well.

Link for Download

No comments:

Post a Comment