This project is read-only.

Instructions

  1. Put the Microsoft command line transformation utility (msxsl.exe) file in the same folder as the BizTalkMapDocumenterHTML.xslt
  2. In the command prompt, navigate to the folder containing the msxsl.exe file
  3. Run and a command like the following:
  4. Either create an HTML file for a single btm map file:
  msxsl "..\..\..\Source\Acme\Integration\Maps\SouceSystemA\MyMap.btm" BizTalkMapDocumenterHTML.xslt -o "MyMap.btm.html"
  • Or create an html file for each map file in a specified folder:
  for %%f in ("..\..\..\Source\Acme\Integration\Maps\SouceSystemA\*.btm") do call msxsl "%%f" BizTalkMapDocumenterHTML.xslt -o "%%~nf.btm.html"
  • Or you can add the following configuration to MSBuild to automate documentation of all maps as part of an build process:
<Target Name="CreateBizTalkMapDocumentation">
	<!-- Identify all of the map files - we'll include the project directories of all BizTalk projects, just to be sure -->
	<CreateItem Include="%(BizTalkProject.ProjectDir)\**\*.btm">
              <Output TaskParameter="Include" ItemName="BizTalkMapFiles"/>
        </CreateItem>
	<Message Text="BizTalk Server maps to document: @(BizTalkMapFiles)"/>
        <!-- Re-create the folder to hold the maps -->
	<RemoveDir Condition="Exists('$(MapDocumentationRoot)')" Directories="$(MapDocumentationRoot)" />
	<MakeDir Directories="$(MapDocumentationRoot)" />
	<!-- All the HTML files are written to a single folder, which assumes that each .btm file has a unique filename! -->
	<Exec Command='"$(MapDocumenterDir)\msxsl" "%(BizTalkMapFiles.FullPath)" "$(MapDocumenterDir)\BizTalkMapDocumenterHTML.xslt" -o "$(MapDocumentationRoot)\%(BizTalkMapFiles.Filename).html"' />
</Target>

Last edited Feb 19, 2010 at 1:49 PM by charliemott, version 3

Comments

masarius Jan 28, 2011 at 3:25 PM 
Due to the fact that msxsl wouldn't run on our server (required MSXML 4.0) I decided to write a task to do the tansform
{{
public class XslTransformer : Task
{
[Required]
public string InputXmlFile { get; set; }

[Required]
public string XslTransformFile { get; set; }

[Required]
public string OutputFile { get; set; }

public override bool Execute()
{
// Validate the arguments
if (string.IsNullOrEmpty(this.InputXmlFile) || !File.Exists(this.InputXmlFile))
{
throw new ArgumentException("InputXmlFile property is not set or it points to invalid file.");
}

if (string.IsNullOrEmpty(this.XslTransformFile) || !File.Exists(this.XslTransformFile))
{
throw new ArgumentException("XslTransformFile property is not set or it points to invalid file.");
}

if (string.IsNullOrEmpty(this.OutputFile) || !Directory.Exists(Path.GetDirectoryName(this.OutputFile)))
{
throw new ArgumentException("OutputFile property is not set, or points to a directory that doesn't exist or cannot be accessed.");
}

XPathDocument doc = new XPathDocument(this.InputXmlFile);
XsltSettings settings = new XsltSettings(true, true);
XslCompiledTransform transform = new XslCompiledTransform();
transform.Load(this.XslTransformFile, settings, new XmlUrlResolver());

using (XmlTextWriter writer = new XmlTextWriter(this.OutputFile, null))
{
transform.Transform(doc, null, writer);
}

return true;
}
}
}}

This caused the following error to be returned "Extension function parameters or return values which have Clr type 'ConcatString' are not supported." so I had to modify the parseLinkPath() and getHtmlSpaces() javascript functions within the XSLT to concatenate an empty strintg to the return value so that the runtime knew to cast it as a string i.e:

{{
function getHtmlSpaces( spacesCount ) {
var spaces = "";
for ( var i = 0; i < spacesCount; i++ ) {
spaces += "&nbsp;";
}
return "" + spaces;
}
}}

{{
function getHtmlSpaces( spacesCount ) {
var spaces = "";
for ( var i = 0; i < spacesCount; i++ ) {
spaces += "&nbsp;";
}
return "" + spaces;
}
}}