Executing and Debugging XSL Transformations in PowerShell

Unfortunaly the is no Cmdlet to execute XSL Transformations in PowerShell. During the development of the Xslt build step of the Crawler-Lib Build-Tools I had to deal with this. This is a small post about executing and debugging XSLT in PowerShell. Executing XSLT in PowerShellThe implementation of th

Unfortunaly the is no Cmdlet to execute XSL Transformations in PowerShell. During the development of the Xslt build step of the Crawler-Lib Build-Tools I had to deal with this. This is a small post about executing and debugging XSLT in PowerShell.

Executing XSLT in PowerShell

The implementation of the XSLT build step shows how to pass parameters and activate debugging prior to the execution of the XSL Transformation:

Debugging XSLT in PowerShell

Debugging of XSLT in PowerShell is possible with Visual Studio. The trick is to attach the PowerShell ISE or the PowerShell Command Processor to the Visual Studio debugger. This is simply be done by "Attach to Process ..." under the "Debug" menu. After that the XSLT file must be loaded in Visual Studio. Then breakpoints can be added. After that preparation the PowerShell script and functions can be executed. When the $xslt.Transform method is called the Visual Studio debugger will break on every breakpoint in the XSLT file.