This document provides instructions for creating a random tip rotator using SharePoint lists and XSL. It describes how to build a custom list to store tips, add the list to a page using the Display Item Form, and then modify the XSL code to display a randomly selected tip from the list each time the page refreshes. The random tip rotator demonstrates using XSL to dynamically display random content from a SharePoint list.
4. BUILD THE LIST
• Site Actions -> More Options -> List -> Custom List
4 | SharePoint Saturday Austin 2013
5. ADD A COLUMN
• Add a Column named TipText (List Tools -> List Settings ->Create Column)
• Set it to be a multiple lines of text type column
5 | SharePoint Saturday Austin 2013
6. ADD DATA
• Add a few Tips to your list:
6 | SharePoint Saturday Austin 2013
7. • ADD THE PAGE
• In SharePoint Designer “Pages”, Add New Page and open it in design mode
• From Insert tab in Designer ribbon, choose Display Item Form
7 | SharePoint Saturday Austin 2013
8. CONFIGURE ITEM LIST IN PAGE
• In Display Item Form dialog, choose the new
list
• Choose “Display item form” and uncheck
“Show standard toolbar”
8 | SharePoint Saturday Austin 2013
9. SHAPE HTML
• In Design view, right click first column and choose Delete Column. Then switch to Code view to finish html
edits
9 | SharePoint Saturday Austin 2013
10. CONFIGURE FORM IN SPD
• From ribbon, select Paging and choose Display All Items
10 | SharePoint Saturday Austin 2013
11. ASYNCH REFRESH
Check Asynchronous Update in ribbon to enable the Refresh Interval link. Then
select a Refresh Interval.
11 | SharePoint Saturday Austin 2013
12. THE FUN STUFF: XSL
• In SPD, switch to Code View tab. First, find the select:
<xsl:for-each select=“$Rows”>
• Modify the select so that it doesn’t get all rows but rather gets only one
random row. Do this by adding an indexer at the end of $Rows.
<xsl:variable name=“Random” select=“ddwrt:Random(1,count($Rows))” />
<xsl:for-each select=“$Rows[position()=$Random]”>
12 | SharePoint Saturday Austin 2013
14. VIEW THE PAGE!
• Save the page and then browse to it in the sharepoint site.
• The tip changes randomly on page refresh and by itself if the page is not
refreshed.
14 | SharePoint Saturday Austin 2013
15. PLEASE FILL OUT SESSION EVALUATIONS
AND
THANK YOU FOR ATTENDING!