public string FormatDate(string szDate, long lcid, long formatFlag); <xsl:value-of select="ddwrt:FormatDateTime(ddwrt:TodayIso(),2057,'dddd MMMM dd yyyy')" />
public string TodayIso(); <xsl:value-of select="ddwrt:TodayIso()"/>
public string Today(); <xsl:value-of select="ddwrt:Today()"/>
Date only as M/d/yyyy. Example: "08/17/2000".
Date only as dddd, MM dd, yyyy. Example: "Thursday, August 17, 2000".
Time only as h:mm. Example: "16:32".
DateTime as M/d/yyyy h:mm. Example: "08/17/2000 16:32".
DateTime as dddd, MM dd, yyyy h:mm. Example: "Thursday, August 17, 2000 16:32".
Time only as h:mm:ss. Example: "16:32:32".
DateTime as M/d/yyyy h:mm:ss. Example: "08/17/2000 16:32:32".
DateTime as dddd, MMMM dd, yyyy h:mm:ss. Example: "Thursday, August 17, 2000 16:32:32".
To display an XLV on another site update the Title, Description, ListId and WebId values in this code; save as a .webpart; upload the file to a web part page (more info on Glyn's blog):
<?xml version="1.0" encoding="utf-8" ?> <webParts> <webPart xmlns="http://schemas.microsoft.com/WebPart/v3"> <metaData> <type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" /> <importErrorMessage>Cannot import this Web Part.</importErrorMessage> </metaData> <data> <properties> <property name="Title" type="string">My List</property> <property name="Description" type="string">A view of My list from the root of the site</property> <property name="ListName" type="string">8480D028-A2ED-474B-8259-BEE394EE4C53</property> <property name="ListId" type="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">8480D028-A2ED-474B-8259-BEE394EE4C53</property> <property name="WebId" type="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">adea17f7-e661-4ff0-91e9-70f021c60647</property> <property name="ExportMode" type="exportmode">All</property> </properties> </data> </webPart> </webParts>
I wanted to configure a contextual search to bring back results from a particular list only and display the results on the same web part page. I also wanted to be able to open the results items in a modal dialogue box (new for SharePoint 2010). On my page I have:
a Search Box web part configured as follows:
Scopes dropdown: Do not show dropdown and default to target results page
a Search Core Results web part configured as follows:
Results Query options / Append Text To Query - Site:http://site/Lists/ListName contentclass:STS_ListItem.
Edit the Display Properties XSL by searching for this line:
Thanks to Glyn for pointing me in the right direction again and Rain Tree Studio for this list of contentclass values, which can be appended to a search query:
case "STS_Web": // Site
case "STS_List_850": // Page Library
case "STS_ListItem_850": // Page
case "STS_List_DocumentLibrary": // Document Library
case "STS_ListItem_DocumentLibrary": // Document Library Items
case "STS_List": // Custom List
case "STS_ListItem": // Custom List Item
case "STS_List_Links": // Links List
case "STS_ListItem_Links": // Links List Item
case "STS_List_Tasks": // Tasks List
case "STS_ListItem_Tasks": // Tasks List Item
case "STS_List_Events": // Events List
case "STS_ListItem_Events": // Events List Item
case "STS_List_Announcements": // Announcements List
case "STS_ListItem_Announcements": // Announcements List Item
case "STS_List_Contacts": // Contacts List
case "STS_ListItem_Contacts": // Contacts List Item
case "STS_List_DiscussionBoard": // Discussion List
case "STS_ListItem_DiscussionBoard": // Discussion List Item
case "STS_List_IssueTracking": // Issue Tracking List
case "STS_ListItem_IssueTracking": // Issue Tracking List Item
case "STS_List_GanttTasks": // Project Tasks List
case "STS_ListItem_GanttTasks": // Project Tasks List Item
case "STS_List_Survey": // Survey List
case "STS_ListItem_Survey": // Survey List Item
case "STS_List_PictureLibrary": // Picture Library
case "STS_ListItem_PictureLibrary": // Picture Library Item
case "STS_List_WebPageLibrary": // Web Page Library
case "STS_ListItem_WebPageLibrary": // Web Page Library Item
case "STS_List_XMLForm": // Form Library
case "STS_ListItem_XMLForm": // Form Library Item
case "urn:content-class:SPSSearchQuery": // Search Query
case "urn:content-class:SPSListing:News": // News Listing
case "urn:content-class:SPSPeople": // People
case "urn:content-classes:SPSCategory": // Category
case "urn:content-classes:SPSListing": // Listing
case "urn:content-classes:SPSPersonListing":// Person Listing
case "urn:content-classes:SPSTextListing": // Text Listing
case "urn:content-classes:SPSSiteListing": // Site Listing
case "urn:content-classes:SPSSiteRegistry": // Site Registry Listing
The following example creates a 'Highlight Box' two column layout output from a SharePoint list by applying custom XSLT styles using the Content Query Web Part. The result looks like this:
Make a copy of the SharePoint XSL stylesheets 'ItemStyle.xsl' and 'ContentQueryMain.xsl' located in the portal root Style Library (http://hostheader/Style%20Library/) and place the copies in a folder called 'Custom' within the Style Library (http://hostheader/Style%20Library/XSL%20Style%20Sheets/Custom/). Rename as 'ItemStyleExtended.xsl' and 'ContentQueryMainExtended.xsl'.
On the web part page where you would like the CQWP displayed, select Edit, Add a Web Part, Upload a Web Part:
On the web part page where you would like the CQWP displayed, select Edit, Add a Web Part, Imported Web Parts, Extended Content Query
Edit the Extended CQWP properties:
In the properties panel expand the Query node. Select the radio button Show items from the following list and enter the path to the associated SharePoint list, (which requires six columns including: Title, Image, Description, URL, Class and Order). Apply these changes by selecting the Apply button at the bottom of the properties panel.
Expand the Presentation node and in the Grouping and Sorting section set the Sort items by to ‘Order’.
In the Styles section set the Item style to HighlightBoxTable.
In the Fields to display section set as in the screenshot.
Expand the Appearance node and set the Chrome to none.
Required. An XPath expression that specifies which node/attribute to extract the value from. It works like navigating a file system where a forward slash (/) selects subdirectories.
disable-output-escaping
yes
no
Optional. "yes" indicates that special characters (like "<") should be output as is. "no" indicates that special characters (like "<") should be output as "<". Default is "no"