(Final) Update: I’ve uploaded a sample project to demonstrate using the StripWhitespace method in an XSL transformation. The project is provided as a zip file and contains a sample input message - download the sample project here.
–
Update: The stylesheet I’m using on modhul.com appears to be shrinking the images in this post on Firefox (IE appears to be unaffected) - simply right-click the image to view the correct size.
–
I’ve used inline Javascript in XSLT for BizTalk maps in the past, but came across the article Extending XSLT with JScript, C#, and Visual Basic .NET by Aaron Skonnard on MSDN last night that discusses, among other things, embedding C#!
Its faily simple to use - the following inline C# method strips whitespace from the input:

Before the inline code will work, you’ll need to inform the XSLT processor about the msxsl and user prefix (user can be anything you want):

Finally, you’ll need to call the inline method from the actual XSLT template:

$InputField here is just an example, you can use any valid input to the value-of element.
This has been tested in BizTalk 2006 but not yet in 2004 (although I have Javascript working in 2004 so I can’t see any reason why it wouldn’t…)
0 Responses to “Inline C#, Javascript and JScript in XSLT”