2
votes

I am using Sharepoint 2010 Content Query Webpart(CQWP) to display a out of the box discussion board list on a page. I have customized the look of CQWP by changing the ItemStyle.xsl file. One of my requirements is to get a hyperlink on the CQWP - i have the format of the url, i need help to build the url with xsl variables.

Url Format:

https://yourdomain.com/sites/site_name/Lists/Team%20Discussion/NewForm.aspx?RootFolder={$DisplayTitle}&ContentTypeId=0x0107

In the above url format '{$Displaytitle}' is the topic of discussion board which i am getting it through xsl:variable. below is the code snippet which i used to get the topic.

<xsl:variable name="DisplayTitle">
           <xsl:call-template name="OuterTemplate.GetTitle">
               <xsl:with-param name="Title" select="@Title"/>
               <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>                   
           </xsl:call-template>
  </xsl:variable>
<xsl:value-of select="$DisplayTitle"/>

now I am using the html anchor tag to get the hyperlink like

<a href="https://yourdomain.com/sites/site_name/Lists/Team%20Discussion/NewForm.aspx?RootFolder={$DisplayTitle}&ContentTypeId=0x0107">Link</a>

But the above is throwing an error and the whole CQWP is not getting display.

1

1 Answers

0
votes

Ref. below code for your issue.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">

<xsl:variable name="DisplayTitle">Para</xsl:variable>

<html>
    <body>
        <a>
            <xsl:attribute name="href">http://www.google.co.in/<xsl:value-of select="$DisplayTitle"/></xsl:attribute>
        </a>
    </body>
</html>
</xsl:template>
</xsl:stylesheet>