This project has moved and is read-only. For the latest updates, please go here.

XslTransformer Error

Topics: Developer Forum, User Forum
Jun 26, 2007 at 7:17 PM
(I'm using the June 25, 2007 release of Sandcastle Help File Builder)
I am able to generate .chm files for a very simple assembly, but for some assemblies I get a Windows "Send Error Report" error saying that "XslTransformer has encountered a problem and needs to close..." (I actually get this message twice when trying to generate the help file).

Is there any other configuration that I need to do? The file that the stack trace is looking for is NOT on the file system, but I don't know why it would look for <empty>.htm.

The comments/stack trace is:
XslTransform (v2.2.64000.4)
Copyright c Microsoft 2005-2006
Info: Applying XSL transformation 'TocToWebContents.xsl'.

Unhandled Exception: System.IO.FileNotFoundException: Could not find file 'C:\TEMP\Documentation\Sandcastle\Geonetric.VitalSite\Help\Working\Output\html\.htm'.
File name: 'C:\TEMP\Documentation\Sandcastle\Geonetric.VitalSite\Help\Working\Output\html\.htm'
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, ...)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)

Jun 26, 2007 at 8:17 PM
It's having problems trying to generate the table of content for the website output (it does that even if you aren't generating that format). Can you e-mail me the content of the .\Working folder after a failed build? My e-mail address is in the About box and the footer of the pages in the help file. You can leave out the assemblies if you'd rather not send them.

If you aren't producing a website output, you can edit the Generate1xTOC.bat and Generate2xTOC.bat files and comment out or delete the last line that runs the TocToWebContents.xsl file to workaround the problem until I get it fixed.

Jun 26, 2007 at 9:46 PM
I'm seeing the exact same problem. I tracked it down to a file="" attribute in my toc.xml file. It looks like this:

<topic id="M:MyNamespace.MyStruct1.op_Addition(MyNamespace.MyStruct2,MyNamespace.MyStruct1)" file="">

It ONLY happens with the Prototype style. vs2005 and hana work fine. I'm still trying to deduce where the blank file attribute came from. I'll let you know if I figure anything out.

Jun 26, 2007 at 9:48 PM
I get this same error when generating CHM output when "Applying XSL transform 'TocToChmContents.xsl'". This only happens when using the 'Prototype' presentation style. I do not get the error when using 'Hana' or 'VS2005' styles.
Jun 26, 2007 at 10:39 PM
If either of you have examples you can send, I'll take a look at them. It may be a bug in Sandcastle's generation of the intermediate toc.xml file which I use to produce the website table of content.

Jun 26, 2007 at 11:03 PM
Ok, I think I'm narrowing in on it. And it does look like a Sandcastle bug as opposed to a SHFB bug.

It appears to be related to overloaded operators. In reflection.xml, the <API> tags for the overload groups for an operator look like this:
<api id="Overload:MyNamespace.MyStruct.Addition">

However, the <API> tags for the individual operator methods look like this:
<api id="M:MyNamespace.MyStruct.op_Addition(MyNamespace.MyStruct,MyNamespace.MyStruct)">

Notice that the second says "op_Addition" while the first says only "Addition". So, in CreatePrototypeToc.xsl, in the 'overloadId' template, the wrong overload id is generated. So then the 'processTypes' template ends up inserting an empty string for the file attribute for that topic.

I'm trying to track down the source of the op_Addition vs. Addition. It should be fairly easy to reproduce this by creating a simple project that has a class with two different overloads of operator+, but I haven't tried it yet.
Jun 27, 2007 at 1:18 AM
I figured it out.

In CreatePrototypeToc.xsl, around line 77, change:

<xsl:call-template name="overloadId">
<xsl:with-param name="memberId" select="@id" />


<xsl:value-of select="overload/@api"/>

The overload API name is already referenced for each overloaded method in the reflection.xml file, so I don't see any reason to call that overloadId template instead of just using it. I spent a grand total of about 30 seconds testing this, though, so no guarantees. It seems to work for me.
Jun 27, 2007 at 2:52 AM
I received an example from Matt and it worked okay for me. My guess is that you all may be using the initial June CTP which was release on 06/18 or 06/19. On 06/22, Microsoft released a refresh to fix a few issues and to rename the VSORCAS style to HANA to avoid confusion with the VS.NET beta. If you haven't done so, download and install the refresh and try it again. It think it will probably work once you do that. I'm going to release a new version of SHFB in about an hour or so too to fix a couple of issues with the VS2005 and HANA styles as well so you might want to grab that too.

Jun 27, 2007 at 3:50 AM
I'm definitely using the latest Sandcastle version. I downloaded it today and the new style is called hana, not vsorcas. (I'm looking at the name of the directory in Sandcastle, not just at the SHFB GUI).
Jun 28, 2007 at 3:36 AM
I've added a file to the Releases page that fixes this issue and several others with the Prototype presentation style. I've also reported it as a bug to Microsoft.

Jul 27, 2007 at 9:28 AM
Edited Jul 27, 2007 at 1:08 PM
I've deployed the files in the Sandcastle dir, but I still get the same System.IO.FileNotFoundException: Could not find file 'C:\...\Help\Working\Output\html\.htm'. exception !

Any suggestions ?
Jul 27, 2007 at 5:03 PM
You might check just to be sure that it did overwrite the necessary files and that DXROOT isn't pointing somewhere else. It could be you've found another cause. As I recall the original problem was caused by operater overloads in a class.

Jul 30, 2007 at 8:03 AM
Hey Eric,

Where should I be looking for that DXRoot ?
I unzipped the presentation files in the correct directory... I got a notification about that I was writing the same files in that location.

I only have the problem with one specific DLL not all my DLL's have this.

Jul 30, 2007 at 5:27 PM
It's a user environment variable. Go to the Control Panel, select System, select the Advanced tab, and click the Environment Variables button.