Referencing to external helpfile from within a NDoc generated helpfile.

This document describes using the ActiveX Html Help Control to link two help-files.
After that I describe a method to implement this from within XML documentation in a C# file with the help of NDOC and an extensibility style sheet.

 

Referencing to another help file with the ActiveX Html Control.

 

To create a link to an external compiled help-file, we can use the shortcut command from the ActiveX Html Control.
To try this , use HTML Workshop and insert a ActiveX Html Control in your html-file:

As a result, this is placed in your html file:

<OBJECT id=MyId type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11" codebase="hhctrl.ocx#Version=5,2,3790,309">
    <PARAM name="Command" value="ShortCut">
    <PARAM name="Item1" value=",hh.exe,MyOtherHelpFile.chm::/main.htm">
</OBJECT>

It defines a ActiveX Html Control object that is able to call "hh.exe" with parameter "MyOtherHelpFile.chm::/main.htm".
To place a hyperlink in your Html code that jumps to the other help file you can use use:

<a href="JavaScript:MyId.Click()">Go to my other help file</a>

Okay, that works.
Now how do we accomplish this from within XML documentation in a C# file?

Using NDoc to do this more easy.

When you don't know what XML documentation in C# is, please refer to "XML documentation" in MSDN.

Of course, we don't want to add the <OBJECT> ...</OBJECT> part directly into our C# file, that would make it unreadable.
What we do want is something like this:

///<externalHelp HelpFile="MyOtherHelpFile.chm::/main.htm" HelpObject="MyId"/>

...to create the ActiveX Html Control Object

and this...

/// For a description of the user-interface, see <externalHelpRef HelpObject="MyId">Go to my other help file</externalHelpRef>

...to define the jump.

We can accomplish this by using this extensibility style-sheet:

  <?xml version="1.0" encoding="UTF-8" ?>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
- <xsl:template match="externalHelp" mode="summary-section">
- <xsl:text disable-output-escaping="yes">
<![CDATA[
<OBJECT id="

  ]]>

  </xsl:text>
  <xsl:value-of select="@HelpObject" />
- <xsl:text disable-output-escaping="yes">
- <![CDATA[
" type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11" >
        <PARAM name="Command" value="ShortCut" />
        <PARAM name="Item1" value=",hh.exe,

  ]]>

  </xsl:text>
  <xsl:value-of select="@HelpFile" />
- <xsl:text disable-output-escaping="yes">
- <![CDATA[
"/>
    </OBJECT>

  ]]>

  </xsl:text>
  </xsl:template>
- <xsl:template match="externalHelpRef" mode="slashdoc">
- <xsl:text disable-output-escaping="yes">
<![CDATA[
<a href="JavaScript:

  ]]>

  </xsl:text>
  <xsl:value-of select="@HelpObject" />
- <xsl:text disable-output-escaping="yes">
<![CDATA[
.Click()">

  ]]>

  </xsl:text>
  <xsl:value-of select="." />
- <xsl:text disable-output-escaping="yes">
<![CDATA[
</a>.<br/>

  ]]>

  </xsl:text>
  </xsl:template>
  </xsl:stylesheet>

 

 

 

Use it without bothering about the details.

  1. Place NDocExternalHelp.xslt in the directory where your NDoc project-file is placed. (See also Setting up NDoc)
  2. Set "ExtensibilityStyleSheet" in your NDoc project to ".\NDocExternalHelp.xslt".
  3. Put
    ///<externalHelp HelpFile="MyOtherHelpFile.chm::/main.htm" HelpObject="MyId"/>
    in your C# file.
    Replace "MyOtherHelpFile.chm::/main.htm" by a proper reference to your help-file.
  4. Put
    <externalHelpRef HelpObject="MyId">
    Go to my other help file</externalHelpRef>
    in your C# file
    Replace "Go to my other help file" by you own text.
  5. Build Documentation using NDoc.