SharePoint Products TechCenter >
SharePoint Products and Technologies Forums
>
SharePoint - Business Data Catalog (pre-SharePoint 2010)
>
Business Data List Web Part and xsl
Business Data List Web Part and xsl
- I have the following xsl in a Business Data List Web Part... is there anyway to alter the xsl to have the rows of the list sorted by FeedbackID in descending order?
Thanks,
Dave
<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" 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="/">
<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/NewDataSet/Row"/>
<table border="0" width="100%" cellpadding="2" cellspacing="0">
<tr valign="top">
<xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
<th class="ms-vh" width="1%" nowrap="nowrap"></th>
</xsl:if>
<th class="ms-vh" nowrap="nowrap">FeedbackID</th>
<th class="ms-vh" nowrap="nowrap">Author</th>
<th class="ms-vh" nowrap="nowrap">Body</th>
<th class="ms-vh" nowrap="nowrap">FeedbackDate</th>
</tr>
<xsl:call-template name="dvt_1.body">
<xsl:with-param name="Rows" select="$Rows"/>
</xsl:call-template>
</table>
</xsl:template>
<xsl:template name="dvt_1.body">
<xsl:param name="Rows"/>
<xsl:for-each select="$Rows">
<xsl:call-template name="dvt_1.rowview"/>
</xsl:for-each>
</xsl:template>
<xsl:template name="dvt_1.rowview">
<tr>
<xsl:if test="position() mod 2 = 1">
<xsl:attribute name="class">ms-alternating</xsl:attribute>
</xsl:if>
<xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
<td class="ms-vb" width="1%" nowrap="nowrap">
<span ddwrt:amkeyfield="" ddwrt:amkeyvalue="ddwrt:EscapeDelims(string(''))" ddwrt:ammode="view"></span>
</td>
</xsl:if>
<td class="ms-vb">
<xsl:value-of select="format-number(@FeedbackID, '#,##0.#;-#,##0.#')"/>
</td>
<td class="ms-vb">
<xsl:value-of select="@Author"/>
</td>
<td class="ms-vb">
<xsl:value-of select="@Body"/>
</td>
<td class="ms-vb">
<xsl:value-of select="ddwrt:FormatDate(string(@FeedbackDate), 1033, 5)"/>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>- Moved byMike Walsh MVPMVP, ModeratorFriday, September 18, 2009 8:02 AMBDC / BDL q (From:SharePoint - Development and Programming)
All Replies
- Moving to the BDC forum.
WSS FAQ sites: http://wssv2faq.mindsharp.com and http://wssv3faq.mindsharp.com
Total list of WSS 3.0 / MOSS 2007 Books (including foreign language) http://wssv3faq.mindsharp.com/Lists/v3%20WSS%20FAQ/V%20Books.aspx What are the Sharepoint options for displaying table data in a list or webpart?
- You can either sort by the BDC webpart (web part properties or xsl inside) or by sorting at the database level.
- You can update this XSLT with the xsl:sort tag. You'll need to add it after <xsl:for-each select="$Rows">
http://www.w3schools.com/xsl/el_sort.asp
For examples on how to use this tag, look at any dataviewwebpart. You can also temporarily create such a part. Open sharepoint designer, open your web, find a listview webpart, select it, look for the smart tag, select convert to data form web part. Now if you look at the XSLT that was generated, it will use the sort command.