I cant seem to get my custom CQWP to link to a list item. If i look at everything exposed in the CQWP (using the showxml trick) the only thing close is the LinkURL which takes the format http://servername/Lists/listname/1_.000 but that does work.

I could build the link myself using the ID but found it strange an actual link wasnt exposed.



Im not 100% sure what you mean, if you are talking about using your own template in ItemStyle.xsl with CQWP then the template OuterTemplate.GetSafeLink from ContentQueryMain.xsl "expose" the URL. The $SafeLinkUrl variable mentioned in the other answer uses this template in all the the predefined templates in ItemStyle.xsl. Just copy and paste that one.


I had the exact problem. Set the property UseCopyUtil of content query webpart to true I thing the call to OuterTemplate.GetSafeLink in ContentQueryMain.xsl will only return the safe link from a Link Column data type


Have you tried using the variable $SafeLinkUrl?


try using @LinkUrl direct in your href something like:

some text

or to use $safelink create variable first

<xsl:variable name="SafeLinkUrl">
        <xsl:call-template name="OuterTemplate.GetSafeLink">
             <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>

thenk you can use $safelink in your herf code.

Hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.