MSBuild XslTransformation Xslt Task example

Goal: Change the connection string of my application while running CodedUI tests. So my dev database is left alone.

Here I’ll post a simple “Hello World” setup to alter a xml to output something else. The xml and xslt example has been taken from w3schools.

When you download this file. It will contain a cmd. It loads up environment variables for msbuild and executes the build.proj.

The build.proj looks like this :


<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!-- Xml & Xslt Examples have been taken from http://www.w3schools.com/xsl/ -->

<Target Name="Build">
<XslTransformation XslInputPath="transform.xslt" XmlInputPaths="source.xml" OutputPaths="out.html" />
</Target>

</Project>

The output is a html page, just as the w3schools demo.

Hope this is a good starting example for your needs.

 

Leave a Reply