Google-Apps
Hauptmenü

Post a Comment On: the urban canuk, eh

"Using Xslt in MSBuild"

5 Comments -

1 – 5 of 5
Blogger Jim said...

Referenced you on StackOverflow:
http://stackoverflow.com/q/1688778/36737

Thanks for the nice post!

10:40 AM

Blogger CW said...

.NET 4.0's XslTransformation task accepts a parameter called 'Parameters', which supplies XSLT parameters to the transform being invoked. This is not well documented; a poster to a MSDN community forum used Reflector to puzzle it out.
It accepts an XML fragment that consists of one or more <Parameter Name="..." Value="..." /> elements. These can be passed as an escaped string, but they can also be specified as child elements of a Property element in a project file:

<PropertyGroup Label="Transform_Parameters">
<ParamName>ExportPath</ParamName>
<ParamValue>..\$(InputDir)\ExportData.xml</ParamValue>
<ParamObjXML>
<Parameter Name='$(ParamName)' Value='$(ParamValue)' />
</ParamObjXML>
</PropertyGroup>

<XslTransformation
Parameters="$(ParamObjXML)" ... />

10:05 PM

Blogger CW said...

PS: Somehow I missed the link in your post to the MSDN forum post on passing parameters. That is the very same post I came across. I guessed that specifying the parameters as child elements of a property and using the property value might work, and lo and behold, it did!

11:07 PM

Blogger Vivek said...

I'm doing similar thing but got stuck on how to replaced the server and database name in the connection string and host in the endpoint address configuration. My thoughts were XSLT replace using regex but it isnt working, any thoughts>

3:16 AM

Blogger bryan said...

@Vivek I largely have been using Xslt to transform things like NUnit or FxCop output into another format for reporting purposes. You could likely transform a config file via Xslt but you might get more mileage with SlowCheetahXml transforms?

6:36 PM

You can use some HTML tags, such as <b>, <i>, <a>

This blog does not allow anonymous comments.

Comment moderation has been enabled. All comments must be approved by the blog author.

You will be asked to sign in after submitting your comment.
Please prove you're not a robot