SharePoint DataFormWebPart 通过Caml和xslt聚合内容
以下是一个例子,SPDataSource用于查询内容,DatasourceMode属性指定查询范围(网站集,网站,列表),SelectCommand是Caml查询;Xsl展示内容,下面列子是用table展示。
<WebPartPages:DataFormWebPart runat="server" EnableOriginalValue="False" ViewFlag="8" ViewContentTypeId="" ListUrl="" ListDisplayName="" ListName="{31A35C42-E326-4EE3-A2F0-7DBDC154C7D1}" ListId="31a35c42-e326-4ee3-a2f0-7dbdc154c7d1" PageSize="-1" UseSQLDataSourcePaging="True" DataSourceID="" ShowWithSampleData="False" AsyncRefresh="False" ManualRefresh="False" AutoRefresh="False" AutoRefreshInterval="60" NoDefaultStyle="TRUE" CacheXslStorage="False" InitialAsyncDataFetch="False" Title="Project report" FrameType="Default" SuppressWebPartChrome="False" Description="" IsIncluded="True" PartOrder="8" FrameState="Normal" AllowRemove="True" AllowZoneChange="True" AllowMinimize="True" AllowConnect="True" AllowEdit="True" AllowHide="True" IsVisible="True" DetailLink="" HelpLink="" HelpMode="Modeless" Dir="Default" PartImageSmall="" MissingAssembly="Cannot import this Web Part." PartImageLarge="" IsIncludedFilter="" ExportControlledProperties="True" ConnectionID="00000000-0000-0000-0000-000000000000" ID="g_2b53a84e_bf26_4583_af64_ac20e428b458" ExportMode="All" __MarkupType="vsattributemarkup" __WebPartId="{EF95A2DE-36BD-4787-97DB-994A2F40E75C}" __AllowXSLTEditing="true" WebPart="true" Height="" Width=""><DataSources>
<SharePoint:SPDataSource runat="server" DataSourceMode="CrossList" SelectCommand="<Webs Scope='Recursive'></Webs><View><Lists ServerTemplate='100'></Lists><Query><Where><And><Eq><FieldRef Name='FSObjType' /><Value Type='int'>0</Value></Eq><Eq>
<FieldRef Name='ContentType' />
<Value Type='Computed'>ProjectList</Value>
</Eq></And></Where><OrderBy><ListProperty Name='Title'/></OrderBy></Query><ViewFields><ListProperty Name="Title" /><FieldRef Name='Function'/><FieldRef Name='StartDate'/><FieldRef Name='TaskDueDate'/><FieldRef Name='PM'/><FieldRef Name='Milestone'/><FieldRef Name='trafficelight'/><FieldRef Name='FSObjType' /><FieldRef Name="ID"/><FieldRef Name="Title"/><FieldRef Name="FileRef"/><FieldRef Name="FileDirRef"/><FieldRef Name="FileLeafRef"/><FieldRef Name="Editor"/><FieldRef Name="Modified"/><FieldRef Name='Region'/></ViewFields></ViewFields></View>" UpdateCommand="" InsertCommand="" DeleteCommand="" UseInternalName="True" UseServerDataFormat="True" ID="dataformwebpart1"><SelectParameters><asp:Parameter DefaultValue="SubWeb" Name="WebID"></asp:Parameter><asp:Parameter DefaultValue="ProjectOverview" Name="ListName"></asp:Parameter>
</SelectParameters>
</SharePoint:SPDataSource>
</DataSources>
<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:param name="URL"/>
<xsl:param name="TopN">3</xsl:param>
<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="Rows" select="/dsQueryResponse/Rows/Row"/>
<table border="0" width="100%" cellpadding="2" cellspacing="0">
<tr valign="top">
<!--<th class="ms-vh" nowrap="nowrap" style="padding-left:0;">Project title</th>-->
<th class="ms-vh" nowrap="nowrap" style="padding-left:0;">Region</th>
<th class="ms-vh" nowrap="nowrap" style="padding-left:0;">Fuction</th>
<th class="ms-vh" nowrap="nowrap" style="padding-left:0;">Start Date</th>
<th class="ms-vh" nowrap="nowrap" style="padding-left:0;">Due Date</th>
<th class="ms-vh" nowrap="nowrap" style="padding-left:0;">PM</th>
<th class="ms-vh" nowrap="nowrap" style="padding-left:0;">Milestone</th>
<th class="ms-vh" nowrap="nowrap" style="padding-left:0;">Traffic light</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:variable name="NewList" select="ddwrt:NameChanged(string(@ListProperty.Title), 0)"/>
<xsl:if test="string-length($NewList) > 0">
<xsl:call-template name="dvt_1.body2">
<xsl:with-param name="Rows" select="$Rows[@ListProperty.Title = current()/@ListProperty.Title]"/>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template name="dvt_1.body2">
<xsl:param name="Rows"/>
<xsl:for-each select="$Rows">
<xsl:sort select="ddwrt:FormatDateTime(string(@Modified), 1033, 'yyyyMMdd HHmmss')" order="descending"/>
<xsl:if test="position() <= $TopN">
<xsl:call-template name="dvt_1.rowview" />
</xsl:if>
</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>
<!--<td class="ProjectReport-td">
<a href="/{substring-after(@FileDirRef, ';#')}/DispForm.aspx?ID={@ID}"><xsl:value-of select="@Title" /></a>
</td>-->
<td class="ProjectReport-td">
<xsl:value-of select="@Region" />
</td>
<td class="ProjectReport-td"><xsl:value-of select="@Function" /></td>
<td><xsl:value-of select="ddwrt:FormatDate(string(@StartDate), 1033, 1)" /></td>
<td><xsl:value-of select="ddwrt:FormatDate(string(@TaskDueDate), 1033, 1)" /></td>
<td><xsl:value-of select="@PM" /></td>
<td><xsl:value-of select="@Milestone" /></td>
<td><img src="{substring-before(@trafficelight, ',')}" /></td>
</tr>
</xsl:template>
</xsl:stylesheet></Xsl>
<DataFields>
@ListId,ListId;@WebId,WebId;@ID,ID;@ListProperty.Title,ListProperty.Title;@FSObjType,FSObjType;@Title,Title;@FileRef,FileRef;@FileDirRef,FileDirRef;@FileLeafRef,FileLeafRef;@Editor,Editor;@Modified,Modified;
</DataFields>
<ParameterBindings>
<ParameterBinding Name="URL" Location="ServerVariable(URL)" DefaultValue=""/>
</ParameterBindings>
</WebPartPages:DataFormWebPart>
SharePoint DataFormWebPart 通过Caml和xslt聚合内容的更多相关文章
- django 聚合内容 RSS/Atom
Django提供了一个高层次的聚合内容框架,让我们创建RSS/Atom变得简单,你需要做的只是编写一个简单的Python类. 一.范例 要创建一个feed,只需要编写一个Feed类,然后设置一条指向F ...
- 第六章:Django 综合篇 - 12:聚合内容 RSS/Atom
Django提供了一个高层次的聚合内容框架,让我们创建RSS/Atom变得简单,你需要做的只是编写一个简单的Python类. 一.范例 要创建一个feed,只需要编写一个Feed类,然后设置一条指向F ...
- SharePoint 2013 图文开发系列之创建内容类型
SharePoint内容类型,是很有特色的,就好比发布新闻,同在一张列表里,可以由内容类型区分图片新闻.文字新闻等,顾名思义,就是在一张列表里发布不同类型的项目. 1.添加新项目,选择SharePoi ...
- sharepoint 2010 如何创建文档库内容类型content type
转:http://biancheng.dnbcw.info/linux/441643.html 这次主要是记录下,如何来创建文档内容类型,例如新建文档的时候,可以选择不同模板,有word,excel文 ...
- SharePoint 2013 开发——获取用户配置文件属性内容(User Profile)
博客地址:http://blog.csdn.net/FoxDave 本篇我们应用SharePoint CSOM(.NET)来读取用户配置文件的信息,个人开始逐渐倾向于客户端模型,因为不用远程登录到 ...
- 深入浅出SharePoint——配置List通过邮件来接收内容
应用场景:在SharePoint的开发中,我们经常需要通过接收并解析Mail的方式来进行数据通信. 解决方案:通常有两种方式:一种是直接使用公司的Exchange服务器,一种是在SharePoint ...
- [SharePoint][SharePoint Designer 入门经典]Chapter8 XSLT数据试图和表单
本章概要: 1.不是利用XSLT web部件 2.使用XSLT web部件创建数据试图 3.使用XSLT表单web部件创建自定义表单 4.利用自定义动作执行列表表单
- [Beginning SharePoint Designer 2010]列表和库&内部内容类型
本章概要: 1.SPS如何组织管理数据 2.如何创建列表和文档库 3.如何使用视图来过滤分类,分组列表和库 4.如何创建内容类型来应用一个定义好的结构到数据和文档中
- SharePoint Rest Api Caml multiple condition query -Rest api 利用Caml多个条件查询
$.ajax({ var cquery="<View><Query><Where><And><Geq><FieldRef N ...
随机推荐
- Python3.x爬虫教程:爬网页、爬图片、自己主动登录
林炳文Evankaka原创作品. 转载请注明出处http://blog.csdn.net/evankaka 摘要:本文将使用Python3.4爬网页.爬图片.自己主动登录.并对HTTP协议做了一个简单 ...
- Debian自启动知识 2015-03-31 20:23 79人阅读 评论(0) 收藏
Debian6添加了insserv用来代替update-rc.d.update-rc.d 就不多做介绍. Debian6里边要添加一个自动启动的服务需要先将启动脚本放在/etc/init.d,然后使用 ...
- 关于PHP定时执行任务的实现(转)
PHP在这方面应该说是比较弱,如果只用php去实现可以如下: <?php ignore_user_abort();//关闭浏览器后,继续执行php代码 set_time_limit(0);//程 ...
- iOS-UICollectionView自定义布局
UICollectionView自定义布局 转载: http://answerhuang.duapp.com/index.php/2013/11/20/custom_collection_view_l ...
- Java基础知识强化之集合框架笔记27:ArrayList集合练习之去除ArrayList集合中的重复字符串元素
1. 去除ArrayList集合中的重复字符串元素(字符串内容相同) 分析: (1)创建集合对象 (2)添加多个字符串元素(包含重复的) (3)创建新的集合 (4)遍历旧集合,获取得到每一个元素 (5 ...
- GET和POST本质上有什么区别
如果有人问你,GET和POST,有什么区别?你会如何回答? 我的经历 前几天有人问我这个问题.我说GET是用于获取数据的,POST,一般用于将数据发给服务器之用. 这个答案好像并不是他想要的.于是他继 ...
- angularJS function
angular.bootstrap 启动Angular angular.element 相当于轻量的JQuery 使用方法: angular.element('#qq'); angular.eleme ...
- ZBar Installer
ZBar Install.For windows:http://sourceforge.net/projects/zbar/files/zbar/0.10/zbar-0.10-setup.exe/do ...
- 动软代码生成器三层用于winform
DBUtility项目中的DbHelperSQL.cs (找自己对应的数据库类型) 修改前20行中的数据库连接字符串获取方式为: //数据库连接字符串(web.config来配置),多数据库可使用Db ...
- Android学习笔记(广播机制)
1.Android的广播机制介绍 收听收音机也是一种广播,在收音机中有很多个广播电台,每个广播电台播放的内容都不相同.接受广播时广播(发送方)并不在意我们(接收方)接收到广播时如何处理.好比我们收听交 ...