以下是一个例子,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="&lt;Webs Scope='Recursive'&gt;&lt;/Webs&gt;&lt;View&gt;&lt;Lists ServerTemplate='100'&gt;&lt;/Lists&gt;&lt;Query&gt;&lt;Where&gt;&lt;And&gt;&lt;Eq&gt;&lt;FieldRef Name='FSObjType' /&gt;&lt;Value Type='int'&gt;0&lt;/Value&gt;&lt;/Eq&gt;&lt;Eq&gt;
&lt;FieldRef Name='ContentType' /&gt;
&lt;Value Type='Computed'&gt;ProjectList&lt;/Value&gt;
&lt;/Eq&gt;&lt;/And&gt;&lt;/Where&gt;&lt;OrderBy&gt;&lt;ListProperty Name='Title'/&gt;&lt;/OrderBy&gt;&lt;/Query&gt;&lt;ViewFields&gt;&lt;ListProperty Name=&quot;Title&quot; /&gt;&lt;FieldRef Name='Function'/&gt;&lt;FieldRef Name='StartDate'/&gt;&lt;FieldRef Name='TaskDueDate'/&gt;&lt;FieldRef Name='PM'/&gt;&lt;FieldRef Name='Milestone'/&gt;&lt;FieldRef Name='trafficelight'/&gt;&lt;FieldRef Name='FSObjType' /&gt;&lt;FieldRef Name=&quot;ID&quot;/&gt;&lt;FieldRef Name=&quot;Title&quot;/&gt;&lt;FieldRef Name=&quot;FileRef&quot;/&gt;&lt;FieldRef Name=&quot;FileDirRef&quot;/&gt;&lt;FieldRef Name=&quot;FileLeafRef&quot;/&gt;&lt;FieldRef Name=&quot;Editor&quot;/&gt;&lt;FieldRef Name=&quot;Modified&quot;/&gt;&lt;FieldRef Name='Region'/&gt;&lt;/ViewFields&gt;&lt;/ViewFields&gt;&lt;/View&gt;" 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) &gt; 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() &lt;= $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聚合内容的更多相关文章

  1. django 聚合内容 RSS/Atom

    Django提供了一个高层次的聚合内容框架,让我们创建RSS/Atom变得简单,你需要做的只是编写一个简单的Python类. 一.范例 要创建一个feed,只需要编写一个Feed类,然后设置一条指向F ...

  2. 第六章:Django 综合篇 - 12:聚合内容 RSS/Atom

    Django提供了一个高层次的聚合内容框架,让我们创建RSS/Atom变得简单,你需要做的只是编写一个简单的Python类. 一.范例 要创建一个feed,只需要编写一个Feed类,然后设置一条指向F ...

  3. SharePoint 2013 图文开发系列之创建内容类型

    SharePoint内容类型,是很有特色的,就好比发布新闻,同在一张列表里,可以由内容类型区分图片新闻.文字新闻等,顾名思义,就是在一张列表里发布不同类型的项目. 1.添加新项目,选择SharePoi ...

  4. sharepoint 2010 如何创建文档库内容类型content type

    转:http://biancheng.dnbcw.info/linux/441643.html 这次主要是记录下,如何来创建文档内容类型,例如新建文档的时候,可以选择不同模板,有word,excel文 ...

  5. SharePoint 2013 开发——获取用户配置文件属性内容(User Profile)

    博客地址:http://blog.csdn.net/FoxDave 本篇我们应用SharePoint CSOM(.NET)来读取用户配置文件的信息,个人开始逐渐倾向于客户端模型,因为不用远程登录到 ...

  6. 深入浅出SharePoint——配置List通过邮件来接收内容

    应用场景:在SharePoint的开发中,我们经常需要通过接收并解析Mail的方式来进行数据通信. 解决方案:通常有两种方式:一种是直接使用公司的Exchange服务器,一种是在SharePoint ...

  7. [SharePoint][SharePoint Designer 入门经典]Chapter8 XSLT数据试图和表单

    本章概要: 1.不是利用XSLT web部件 2.使用XSLT web部件创建数据试图 3.使用XSLT表单web部件创建自定义表单 4.利用自定义动作执行列表表单

  8. [Beginning SharePoint Designer 2010]列表和库&内部内容类型

    本章概要: 1.SPS如何组织管理数据 2.如何创建列表和文档库 3.如何使用视图来过滤分类,分组列表和库 4.如何创建内容类型来应用一个定义好的结构到数据和文档中

  9. SharePoint Rest Api Caml multiple condition query -Rest api 利用Caml多个条件查询

    $.ajax({ var cquery="<View><Query><Where><And><Geq><FieldRef N ...

随机推荐

  1. PPT扁平化风格设计手册

    钱文嘉:颜色选择,搭配 http://www.pptfans.cn/341917.html

  2. tcp-backlog配置

    redis tcp-backlog配置   在redis2.8版本中有一个tcp-backlog配置, 说明如下: # TCP listen() backlog.## In high requests ...

  3. java获取当前方法

    1.获取当前方法堆栈,我们一般用 StackTraceElement[] stes = Thread.currentThread().getStackTrace(); 想要获取当前方法,切记不够灵活, ...

  4. 第三篇:GPU 并行编程的运算架构

    前言 GPU 是如何实现并行的?它实现的方式较之 CPU 的多线程又有什么分别? 本文将做一个较为细致的分析. GPU 并行计算架构 GPU 并行编程的核心在于线程,一个线程就是程序中的一个单一指令流 ...

  5. java io 流基础

  6. 11.3 morning

    noip模拟题day1 总览(Overview)   题目名称 取模 等比数列 回文串 程序名 mod sequence palindromes 输入文件名 mod.in sequence.in pa ...

  7. int? 参数是这个的时候 是可以传入null的 而int的就不行

    such as     pager.CurrentPageIndex = (page != null ? (int)page : 1);

  8. web前端:js

    内嵌样式<script></script> alert(“123”)弹出对话框 document.write(“test”) 引入方式 <title></ti ...

  9. cocos2dx 的Hello world的简单分析

    Node之间的关系: 场景AppDelegate.cpp又要由导演去调用然后进行表演: // create a scene. it's an autorelease object auto scene ...

  10. padding and margin.

    padding is the space between the content and the border, whereas margin is the space outside the bor ...