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 appropriate C# project (ePublisher XSL.VS2005.zip or ePublisher XSL.VS2010.zip).

5. Unzip the C# project to a convenient location.

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

7. Drag your favorite ePublisher XSL files into the Visual C# Express window.

8. Within the C# interface, set breakpoints as necessary by choose Debug > Toggle Breakpoint (F9).

9. Hit F5 to start ePublisher and begin debugging.

10.Choose the project you want to debug.

11.Generate the project.


In the ePublisher C# folder, there 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 2010-08-25 00:33:29 by BenAllums)