SharePoint Designer 2010 – XSLT Filtering ( XSLT Filter ) in XSLT List View Web Parts.

21 במרץ 2011

In SharePoint Designer 2010 you can insert Data View Web Parts in two ways


1. The first way is Empty Data View WP – .DataFormWebPart  Web Part. You can put thia WP on page and after this insert data source for show specific data.



In this WP you can filter data by specific data source field and XSLT condition.


 


After selecting "Add XSLT filtering" you can click on button "Edit" and write or choose XSLT Condition.


 


 For example if we need show only events those will came after current time (XSLT condition on DateTime Calendar Field), we put XSLT condition:


[number(translate(substring-after(@EventDate,' '), ':',")) > number(substring(translate(substring-after(ddwrt:TodayIso(),'T'), ':',"), 0, 5)) ]


2. The second way is Specific Library/List Data View WP –  XsltListViewWebPart Web Part. In this WP you can put filter condition by specific sharepoint library/list


field.  In "Option" Ribbon click filter icon and choose field and condition.


.


Filter Dialog is showed here



In this WP on Filter Condition Dialog option "Add XSLT filtering" is not available. But we can put  XSLT filtering condition inside XSLT code.


Before starting with XSLT Condition, we need customize XsltListViewWebPart Web Part.


Go to "Design" Ribbon, choose "Customize XSLT", select the first "Customize Entire View" and after this "Customize Item".




 


For changing XSLT code we need locate rows as show in picture. 



Locate row that start with <xsl:param name="AllRows"…. and put your condition before $EntityName, for example


If we need show only events those will came after current time


<xsl:param name="AllRows" select="/dsQueryResponse/Rows/Row[(


number(translate(substring-after(@EventDate,' '), ':',")) &gt; number(substring(translate(substring-after(ddwrt:TodayIso(),'T'), ':',"), 0, 5))) and


($EntityName = " or (position() &gt;= $FirstRow and position() &lt;= $LastRow))]"/>


 


After this you can enjoy XSLT Filtering.

Hope this atricle help you solve problem with filtering on Data View Web Parts.


 

הוסף תגובה
facebook linkedin twitter email

כתיבת תגובה

האימייל לא יוצג באתר. שדות החובה מסומנים *