Sandcastle tweeks

Like I told a little earlier, I'm currently using Sandcastle and SHFB to create my help files, and I think most of us use the <see langword="null"> in our XML docs, hoping that it would be translated into something like "null (Nothing in Visual Basic)".

And when I compiled my help file I found it was being replaced with nullNothing.

Which was not exactly what I was expecting...

So, poking here and there I added the template below to the following Sandcastle file:

Sandcastle\
  Presentation\
    Shared\
      transforms\
        utilities_reference.xsl

And that finally translated it right, although not quite using <see langword="..."/>, instead a construct like <langword name="..." />.

<!-- Support for the tag <langword name="" /> -->
<xsl:template match="langword@name">
  <xsl:choose>
    <xsl:when test="@name='null' or @name='Nothing'">
      <span class="keyword">null</span>
      <xsl:text> (</xsl:text>
      <span class="keyword">Nothing</span>
      <xsl:text> in Visual Basic)</xsl:text>
    </xsl:when>
    <xsl:when test="@name='static' or @name='Shared'">
      <span class="keyword">static</span>
      <xsl:text> (</xsl:text>
      <span class="keyword">Shared</span>
      <xsl:text> in Visual Basic)</xsl:text>
    </xsl:when>
    <xsl:when test="@name='virtual' or @name='Overridable'">
      <span class="keyword">virtual</span>
      <xsl:text> (</xsl:text>
      <span class="keyword">Overridable</span>
      <xsl:text> in Visual Basic)</xsl:text>
    </xsl:when>
    <xsl:otherwise>
      <span class="keyword">
        <xsl:value-of select="@name" />
      </span>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

Comments