1.建立 View,然后用 ListID + ViewID 进行筛选;
2.直接写在XSL里,对 Rows进行筛选,如下:
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[(substring-after(@Title,';#')='Test')]"/>
有时用户会要求对多个Columns数据进行统计,每一个Column对应一个或多个条件,这个时候就要自己写XSL。
<xsl:template name="dvt_1">
<xsl:variable name="dvt_StyleName">Table</xsl:variable>
<xsl:variable name="Rows" select="/soap:Envelope/soap:Body/ddw1:GetListItemsResponse/ddw1:GetListItemsResult/ddw1:listitems/rs:data/z:row"/>
<xsl:variable name="dvt_RowCount" select="count($Rows)"/>
<xsl:variable name="nsLT5days" select="/soap:Envelope/soap:Body/ddw1:GetListItemsResponse/ddw1:GetListItemsResult/ddw1:listitems/rs:data/z:row[(@ows_Status='In Progress')] [(number(ddwrt:FormatDateTime(ddwrt:FormatDate(string(substring-after(@ows_Created_x0020_date,';#')),1033,1),1033,'yyyyMMdd')) < number(ddwrt:FormatDateTime(ddwrt:FormatDate(string(ddwrt:Today()),1033,1),1033,'yyyyMMdd'))-5)]" />
<xsl:variable name="nstGT5days" select="/soap:Envelope/soap:Body/ddw1:GetListItemsResponse/ddw1:GetListItemsResult/ddw1:listitems/rs:data/z:row[(@ows_Status='In Progress')][(number(ddwrt:FormatDateTime(ddwrt:FormatDate(string(substring-after(@ows_Created_x0020_date_x0020_add_x00,';#')),1033,1),1033,'yyyyMMdd')) >= number(ddwrt:FormatDateTime(ddwrt:FormatDate(string(ddwrt:Today()),1033,1),1033,'yyyyMMdd'))-5)]" />
其中,nsLT5days是借鉴Rows的写法来自定义的variable,在row后面加上所需的筛选条件 z:row[()][()]…
统计:<xsl:value-of select="count($nsLT5days)" />
求和:<xsl:value-of select="sum($nsLT5days/@Numbers)" />