Hmm. Interesting problem – I had a Content Query Web Part (CQWP) that was displaying the Title for Discussions. Unfortunately when you clicked on them, they took you to the display form for the start of the thread, not the entire thing:
Okay, but could I get it to link to a view of the discussion thread itself?
I tried using the LinkUrl property, but that didn’t work very well – when I tried to set it as the link in the CQWP it said that that field didn’t exist. It does though.
So I checked Google. It turns out that this has been written about before. The short of it seems to be that the XSL styles that are emitting the link on the page call an XSL template OuterTemplate.GetSafeLink :
[xslt]<xsl:variable name="myLink">
<xsl:call-template name="OuterTemplate.GetSafeLink">
<xsl:with-param name="UrlColumnName" select="’LinkUrl’"/>
</xsl:call-template>
</xsl:variable>[/xslt]
We don’t want the safe link – it takes us to the Display Form – but rather we just want the LinkUrl value itself:
[xslt]<xsl:variable name="myLink">
<xsl:value-of select="@LinkUrl"/>
</xsl:variable> [/xslt]
That seems to work nicely. It’s a bit of a pain that you have to modify ItemStyles.xsl – and it’s a fair while since I last had to!