Attribute testing on a member does not work

Feb 7, 2012 at 4:54 PM

Hi everybody. We have extension methods in our API. Those are shown perfectly well on the class-page which the extension method extends. The only problem that the normal "(Inherited from XXX.)" text is added to the end of the description.

I would like to change that text to something else... like (Extension method from XXX.)

It sounds easy, but when I try to add that to the XSL, it doesn't show up. (It is like I didn't add anything.)

I tried this:

        <xsl:when test="attributes/attribute/type[@api='T:System.Runtime.CompilerServices.ExtensionAttribute']">
          <xsl:text> </xsl:text>
          <include item="extensionMethodFrom">
            <parameter>
              <xsl:apply-templates select="containers/type" mode="link" />
            </parameter>
          </include>
        </xsl:when>

The item is added to the content xml:
    <item id="extensionMethodFrom">(Extension method from {0}.)</item>

I guess in the when condition the attribute cannot be found... do you have an idea how to do this properly?

Thank you in advance,

Zoltán

Feb 7, 2012 at 5:32 PM

Hello Zoltán,

I have tried to understand your question but still could not see the problem.
If possible, post a sample or screenshot somewhere and provide the link here.

From my test, I could only see (Defined by ExtensionClass) text, which is not what you mean.

Best regards,
Paul. 

Feb 8, 2012 at 10:47 AM

Hi Paul,

I am sorry about the few information I gave.

I was using the Prototype presentation style, so for me the Extension methods were getting the (Inherited by ExtensionClass.) But you gave me a good idea, and I checked the VS2005 style, and I found out how it was done there. I copied the corresponding part, and changed the text, so now it works.

For anybody, who need this, here is the xsl-segment I added to the utilities-reference.xsl:

          <xsl:when test="@source='extension' and containers/type">
            <xsl:text> </xsl:text>
            <include item="extensionMethodFrom">
              <parameter>
                <xsl:apply-templates select="containers/type" mode="link" />
              </parameter>
            </include>
          </xsl:when>

I hope it helps.