0

I am trying to create my own item style for the content query web part. I need to create a variable to display. The following for title works ...

<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>

How do I do create the same variable for the Release Date column? The official name for that seems to be ... Release_x0020_Date

Thanks

1

After your above variable, add a second variable:

<xsl:variable name="ReleaseDate">
   <xsl:value-of select="ddwrt:FormatDateTime(@ReleaseDate, 1033, 1)"/>
</xsl:variable>

I used date formatting to make it look nicer, you can find other format options here: Custom Date Formats in SharePoint XSL.

When you go in to edit your CQWP, select the template you added this variable to (I usually just make a new one, copy and paste whatever template is closest and add this variable to it). When you select the template, you'll see a new textbox for ReleaseDate, input the column name here (e.g. "Release Date;"). The CQWP will display the title and the release date.

Image below shows what I've done, I have the task title for Title (this provides a link to the task display form) and the due date, in my case, below it.

Task with Date in CQWP

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.