Several people have asked how to change the under of items displayed in the slider and how to change the sort order.
Item Limit
To change the number of items displayed use the code below.
<Xsl> <xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal"> <xsl:output method="html" indent="no"/> <xsl:decimal-format NaN=""/> <xsl:param name="dvt_apos">'</xsl:param> <xsl:variable name="dvt_1_automode">0</xsl:variable> <xsl:template match="/" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:SharePoint="Microsoft.SharePoint.WebControls"> <xsl:call-template name="dvt_1"/> </xsl:template> <xsl:template name="dvt_1"> <xsl:variable name="dvt_StyleName">Table</xsl:variable> <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row" /> <xsl:variable name="RowLimit" select="3" /> <xsl:variable name="dvt_RowCount" select="count($Rows)" /> <xsl:variable name="IsEmpty" select="$dvt_RowCount = 0" /> <link rel="stylesheet" href="css/page.css" type="text/css" media="screen" /> <link rel="stylesheet" href="css/slider.css" type="text/css" media="screen" /> <script type="text/javascript" src="js/jquery.easing.1.2.js"></script> <script src="js/jquery.anythingslider.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript"></script> <div class="anythingSlider"> <div class="wrapper"> <ul> <xsl:call-template name="dvt_1.body"> <xsl:with-param name="Rows" select="$Rows" /> <xsl:with-param name="FirstRow" select="1" /> <xsl:with-param name="LastRow" select="$RowLimit" /> </xsl:call-template> </ul> </div> </div> </xsl:template> <xsl:template name="dvt_1.body"> <xsl:param name="Rows" /> <xsl:param name="FirstRow" /> <xsl:param name="LastRow" /> <xsl:for-each select="$Rows"> <xsl:variable name="dvt_KeepItemsTogether" select="false()" /> <xsl:variable name="dvt_HideGroupDetail" select="false()" /> <xsl:if test="(position() >= $FirstRow and position() <= $LastRow) or $dvt_KeepItemsTogether"> <xsl:if test="not($dvt_HideGroupDetail)" ddwrt:cf_ignore="1"> <xsl:call-template name="dvt_1.rowview" /> </xsl:if> </xsl:if> </xsl:for-each> </xsl:template> <xsl:template name="dvt_1.rowview"> <li> <div class="textSlide"> <h3><a href="/{@FileDirRef}/DispForm.aspx?ID={@ID}" title="{@Title}"><xsl:value-of select="@Title" /></a></h3> <xsl:value-of select="@Body" disable-output-escaping="yes" /> </div> </li></xsl:template> </xsl:stylesheet> </Xsl>
On line 13 change the RowLimit to the number of items you would like to show. For example if you wanted to show 6 items you would change line 13 to this
<xsl:variable name="RowLimit" select="6" />
Sort Order
Changing the sort order can be done through SharePoint Designer once you are using the updated code
- Click on the arrow to show the common data view tasks.
- Click on ‘Sort and Group’ the second option.
- Make changes as needed.
If dont want to do it that way there is another option.
- Open the page in SharePoint Designer
- In code view find this ‘SharePoint:SPDataSource’ you will need to edit this tag.
- Find the SelectCommand and add/edit the OrderBy attibute.
- See the code below for an example. (Ordered by Created Date in Ascending order). Its basically a CAML query.