Debugging XSL

One of the great advantages of being on the .NET platform is that the ePublisher platform now includes a debugger! Well, not really, but Microsoft does make one available for free in the form of Visual Studio Express. Two downloads, one install, and just a wee bit of chicanery, you too can debug XSL like a Pro.

1. Download Visual C# Express.

2. Install Visual C# Express. Microsoft should mail you a free license key.

3. To enable XSL debugging in ePublisher, follow these steps:

  1. Shutdown ePublisher.
  2. Edit "WebWorks.ePublisherPro.exe.config" in your install directory with Notepad.

  3. Add the following entry if not present and set it to "true".
      <add key="DebugXSLTransforms"
           value="true" /> 
  4. Save your changes.

4. Download the attached ePublisher XSL.zip

5. Example ePublisher XSL.zip to a convenient location.

6. Open up the resulting folder and double-click on "ePublisher XSL.sln".

7. Drag your favorite XSL files into the Visual C# Express window. Set breakpoints as necessary.

8. Hit F5 to start ePublisher and being debugging.


The magic that makes all this work lives in a file called "ePublisher XSL.csproj.user". We've added an entry like so:

    <StartAction>Program</StartAction>
    <StartProgram>C:\Program Files\WebWorks\ePublisher Pro\WebWorks.ePublisherPro.exe</StartProgram>

This appears within both the Debug and Release property groups:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <StartAction>Program</StartAction>
    <StartProgram>C:\Program Files\WebWorks\ePublisher Pro\WebWorks.ePublisherPro.exe</StartProgram>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <StartAction>Program</StartAction>
    <StartProgram>C:\Program Files\WebWorks\ePublisher Pro\WebWorks.ePublisherPro.exe</StartProgram>
  </PropertyGroup>
</Project>

Adjust the install path as necessary for your site.

Original details on this technique can be found here http://stewartr.blogspot.com/2006/09/debugging-nunit-in-visual-studio.html.

DevCenter/Tips/DebuggingXSL (last edited 2008-05-16 22:01:35 by BenAllums)