Content Query Web Part Error Message - 'ddwrt' is not defined
-
16-10-2019 - |
Pergunta
I'm following this web article on configuring content query web part - http://erikswenson.blogspot.com/2010/03/sharepoint-2010-content-query-for-blog.html
When I try to add this line to my xsl
<xsl:variable name="StartDate">
<xsl:value-of select="ddwrt:FormatDateTime(string(@Modified), 1033, 'g')" />
</xsl:variable>
I get an error message
Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.
Correlation ID:e684f7ba-32f3-418b-83a9-e2c4f228d5e5
The log file has this.
Error while executing web part: System.Xml.Xsl.XslLoadException: Prefix 'ddwrt' is not defined
Where/How do I add this namespace to ItemStyle.xsl?
Solução
You'll need to make sure that the xsl:stylesheet declares the ddwrt namespace. To do this, you'll need to add this to your xsl:stylesheet declaration if it isn't there already, though in your case we know it isn't because you're getting an error:
xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
You can see more details on this idea here: https://www.nothingbutsharepoint.com/sites/eusp/Pages/An-Update---How-to-Configure-a-Custom-Item-Style-for-a-Discussion-Board-using-the-Content-Query-Web-Part.aspx