Announcement WebPart using XSLT


Create a List view webpart using SharePoint Designer 2010/2013

<WebPartPages:DataFormWebPart runat="server" IsIncluded="True" AsyncRefresh="True" FrameType="None" NoDefaultStyle="TRUE" ViewFlag="8" Title="DataView 1" PageType="PAGE_NORMALVIEW" __markuptype="vsattributemarkup" __WebPartId="{00DF9528-345E-433F-BC9E-B0D830B0410B}" id="g_00df9528_345e_433f_bc9e_b0d830b0410b">
<DataSources>
<SharePoint:SPDataSource runat="server" DataSourceMode="List" UseInternalName="true" UseServerDataFormat="true" selectcommand="&lt;View&gt;&lt;/View&gt;" id="spdatasource1"><SelectParameters><asp:Parameter Name="ListID" DefaultValue="5F17A09F-FF25-4357-892F-14ABF651B788"/>
</SelectParameters><DeleteParameters><asp:Parameter Name="ListID" DefaultValue="5F17A09F-FF25-4357-892F-14ABF651B788"/>
</DeleteParameters><UpdateParameters><asp:Parameter Name="ListID" DefaultValue="5F17A09F-FF25-4357-892F-14ABF651B788"/>
</UpdateParameters><InsertParameters><asp:Parameter Name="ListID" DefaultValue="5F17A09F-FF25-4357-892F-14ABF651B788"/>
</InsertParameters>
</SharePoint:SPDataSource>
</DataSources>

<datafields>@ID,ID;@ContentType,Content Type;@Title,Title;@Modified,Modified;@Created,Created;@Author,Created By;@Editor,Modified By;@_UIVersionString,Version;@Attachments,Attachments;@File_x0020_Type,File Type;@FileLeafRef,Name (for use in forms);@FileDirRef,Path;@FSObjType,Item Type;@_HasCopyDestinations,Has Copy Destinations;@_CopySource,Copy Source;@ContentTypeId,Content Type ID;@_ModerationStatus,Approval Status;@_UIVersion,UI Version;@Created_x0020_Date,Created;@FileRef,URL Path;@ItemChildCount,Item Child Count;@FolderChildCount,Folder Child Count;@AppAuthor,App Created By;@AppEditor,App Modified By;@Body,Body;@Expires,Expires;</datafields>
<XSL>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ddwrt2="urn:frontpage:internal">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="*" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:ghost="">

<style type="text/css">
.container {border: 1px solid #cccccc;background-color: #f8f8f8;padding:10px;margin-bottom:10px;font-family:  Arial, Helvetica, sans-serif}
.heading {font-size:15px;font-weight:bold;color:#333;margin-bottom:4px;}
.body {font-size:14px;font-weight:normal;color: #666;margin-bottom:4px;}
.footer {font-size:11px;font-weight:bold;color: #999;margin-bottom:4px;}
</style> <xsl:for-each select="/dsQueryResponse/Rows/Row">
<div class="container">
<div style="float:left; padding:0px 15px 2px 0px"><img src="{@Image}"></img></div>
    <div class="heading"><xsl:value-of select="@Title"/><xsl:text> - </xsl:text><xsl:value-of select="ddwrt:FormatDateTime(string(@Modified), 1033, 'd MMMM, yyyy')"/></div>
    <div class="body"><xsl:value-of select="@Body" disable-output-escaping="yes"/></div>
    <div><xsl:text>By </xsl:text><xsl:value-of select="@Author.title"/><br/>
    </div>
</div>
</xsl:for-each>

</xsl:template>
</xsl:stylesheet>
</XSL>
</WebPartPages:DataFormWebPart>



Comments

Popular posts from this blog

IRM and the Object Model

This content database has a schema version which is not supported in this farm

Activate and Deactivate Feature through PowerShell