我想知道是否有人可以提供帮助。
我是 Xpath 和 SharePoint 2010 的新手,但到目前为止我相处得很好,但是这个小问题让我很头疼!
如果在 SharePoint 列表的同一列中没有具有相似名称的另一个值(希望这是有道理的),我正在尝试做的是在字段中显示该值。
如果您对要比较的值进行硬编码,我有以下选择,
<xsl:value-of select="$thisNode/@Txt_x0020_Doc_x0020_Ref[contains(.,'Test')]"/>
这将显示在这种情况下具有测试的所有值。
我所追求的是将当前选择的 Txt_x0020_Doc_x0020_Ref 列与 Txt_x0020_Doc_x0020_Ref 列中的所有其他结果进行比较
如果有人能指出我正确的方向,那就太棒了!
*更新@Ian 这是共享点设计器中页面的全部内容。
我想要它做的是删除重复的命名值并仅显示最高值,即
当前列表
我想要的是
只是为了提供有关 SharePoint 列表用途的更多信息。它是一个表单库,存储输入的表单,所有表单都被提交,所以每个版本都被保留,下面的视图的目的是只显示表单的最新版本,然后我会有另一个视图来显示其他版本.
请在下面找到来自 sharepoint 设计器的完整代码:
<code>
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
<SharePoint:ListProperty Property="TitleOrFolder" runat="server"/> -
<SharePoint:ListProperty Property="CurrentViewTitle" runat="server"/></asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">
<SharePoint:ListProperty Property="TitleBreadcrumb" runat="server"/>
<SharePoint:UIVersionedContent UIVersion="4" runat="server">
<ContentTemplate>
<span class="ms-ltviewselectormenuheader" runat="server">
<SharePoint:ListTitleViewSelectorMenu AlignToParent="true" id="LTViewSelectorMenu" runat="server" />
</span>
</ContentTemplate>
</SharePoint:UIVersionedContent>
</asp:Content>
<asp:content contentplaceholderid="PlaceHolderAdditionalPageHead" runat="server">
<SharePoint:RssLink runat="server"/>
</asp:content>
<asp:Content ContentPlaceHolderId="PlaceHolderPageImage" runat="server">
<SharePoint:ViewIcon Width="145" Height="54" runat="server"/></asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderLeftActions" runat="server">
<SharePoint:RecentChangesMenu runat="server" id="RecentChanges"/>
<SharePoint:ModifySettingsLink runat="server"/>
</asp:Content>
<asp:Content ContentPlaceHolderId ="PlaceHolderBodyLeftBorder" runat="server">
<div height="100%" class="ms-pagemargin"><img src="/_layouts/images/blank.gif" width='6' height='1' alt="" /></div>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<WebPartPages:WebPartZone runat="server" FrameType="None" ID="Main" Title="loc:Main"><ZoneTemplate>
<WebPartPages:XsltListViewWebPart runat="server" Description="" PartOrder="2" Default="TRUE" HelpLink="" AllowRemove="True" IsVisible="True" AllowHide="True" UseSQLDataSourcePaging="True" ExportControlledProperties="False" IsIncludedFilter="" DataSourceID="" Title="Demand Management" ViewFlag="5" AllowConnect="True" DisplayName="Main View" PageType="PAGE_DEFAULTVIEW" FrameState="Normal" PageSize="-1" PartImageLarge="" AsyncRefresh="False" ExportMode="NonSensitiveData" Dir="Default" DetailLink="/Strategy-and-Architecture/Business-Account-Managers/Demand Management" ShowWithSampleData="False" ListId="cafbbdc7-079d-4ae1-bf40-4a695834e510" ListName="{CAFBBDC7-079D-4AE1-BF40-4A695834E510}" FrameType="Default" PartImageSmall="" IsIncluded="True" SuppressWebPartChrome="False" AllowEdit="True" ViewGuid="{1766D7BE-7DC0-4277-8418-EBA815716C60}" AutoRefresh="False" AutoRefreshInterval="60" AllowMinimize="True" WebId="00000000-0000-0000-0000-000000000000" ViewContentTypeId="0x" InitialAsyncDataFetch="False" GhostedXslLink="main.xsl" MissingAssembly="Cannot import this Web Part." HelpMode="Modeless" ID="g_1766d7be_7dc0_4277_8418_eba815716c60" ConnectionID="00000000-0000-0000-0000-000000000000" AllowZoneChange="True" TitleUrl="/Strategy-and-Architecture/Business-Account-Managers/Demand Management" ManualRefresh="False" __MarkupType="vsattributemarkup" __WebPartId="{1766D7BE-7DC0-4277-8418-EBA815716C60}" __AllowXSLTEditing="true" __designer:CustomXsl="fldtypes_Ratings.xsl" WebPart="true" Height="" Width=""><ParameterBindings>
<ParameterBinding Name="dvt_sortdir" Location="Postback;Connection"/>
<ParameterBinding Name="dvt_sortfield" Location="Postback;Connection"/>
<ParameterBinding Name="dvt_startposition" Location="Postback" DefaultValue=""/>
<ParameterBinding Name="dvt_firstrow" Location="Postback;Connection"/>
<ParameterBinding Name="OpenMenuKeyAccessible" Location="Resource(wss,OpenMenuKeyAccessible)" />
<ParameterBinding Name="open_menu" Location="Resource(wss,open_menu)" />
<ParameterBinding Name="select_deselect_all" Location="Resource(wss,select_deselect_all)" />
<ParameterBinding Name="idPresEnabled" Location="Resource(wss,idPresEnabled)" />
<ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noitemsinview_doclibrary)" />
<ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noitemsinview_doclibrary_howto2)" />
</ParameterBindings>
<XmlDefinition>
<View Name="{1766D7BE-7DC0-4277-8418-EBA815716C60}" DefaultView="TRUE" Type="HTML" DisplayName="Main View" Url="/Strategy-and-Architecture/Business-Account-Managers/Demand Management/Forms/Main View.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/images/dlicon.png">
<Query/>
<ViewFields>
<FieldRef Name="LinkFilename"/>
<FieldRef Name="Txt_x0020_Doc_x0020_Ref"/>
<FieldRef Name="Txtdescription"/>
<FieldRef Name="Txt_x0020_Doc_x0020_Status_x0020_Hidden"/>
<FieldRef Name="Ddl_x0020_DM_x0020_Project_x0020_Status"/>
<FieldRef Name="Modified"/>
<FieldRef Name="Editor"/>
<FieldRef Name="Txt_x0020_Version"/>
<FieldRef Name="Title" Explicit="TRUE"/>
</ViewFields>
<RowLimit Paged="TRUE">30</RowLimit>
<Toolbar Type="Standard"/>
</View>
</XmlDefinition>
<DataFields>
</DataFields>
<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" xmlns:o="urn:schemas-microsoft-com:office:office">
<xsl:include href="/_layouts/xsl/main.xsl"/>
<xsl:include href="/_layouts/xsl/internal.xsl"/>
<xsl:param name="AllRows" select="/dsQueryResponse/Rows/Row[$EntityName = '' or (position() >= $FirstRow and position() <= $LastRow)]"/>
<xsl:param name="dvt_apos">'</xsl:param>
<xsl:template match="FieldRef[@Name='LinkFilename']" name="LinkFilenameNoMenu.LinkFilename" mode="Computed_LinkFilename_body" ddwrt:tag="a" ddwrt:dvt_mode="body" ddwrt:ghost="" xmlns:ddwrt2="urn:frontpage:internal">
<xsl:param name="thisNode" select="."/>
<xsl:param name="ShowAccessibleIcon" select="0"/>
<xsl:param name="folderUrlAdditionalQueryString"/>
<xsl:param name="IncludeOnClick" select="1"/>
<xsl:choose>
<xsl:when test="$thisNode/@FSObjType='1'">
<xsl:choose>
<xsl:when test="$RecursiveView">
<xsl:value-of select="$thisNode/@FileLeafRef" />
</xsl:when>
<xsl:otherwise>
<xsl:variable name="FolderURL">
<xsl:value-of select="$PagePathFinal" />RootFolder=<xsl:value-of select="$thisNode/@FileRef.urlencode" /><xsl:value-of select="$ShowWebPart"/>&FolderCTID=<xsl:value-of select="$thisNode/@ContentTypeId" />&View=<xsl:value-of select="$View"/><xsl:value-of select="$folderUrlAdditionalQueryString"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$IsDocLib">
<xsl:variable name="OnMouseDownJS">
javascript:VerifyFolderHref(this,event,'<xsl:value-of select="$thisNode/@File_x0020_Type.url" />','<xsl:value-of select="$thisNode/@File_x0020_Type.progid" />','<xsl:value-of select="$XmlDefinition/List/@DefaultItemOpen" />','<xsl:value-of select="$thisNode/@HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon" />','<xsl:value-of select="$thisNode/@HTML_x0020_File_x0020_Type" />','<xsl:value-of select="$thisNode/@serverurl.progid" />');return false;
</xsl:variable>
<xsl:variable name="OnClickJS">
return HandleFolder(this,event,"<xsl:value-of select="$PagePathFinal" />RootFolder=" + escapeProperly("<xsl:value-of select="$thisNode/@FileRef" />") + '<xsl:value-of select="$ShowWebPart" />&FolderCTID=<xsl:value-of select="$thisNode/@ContentTypeId" />&View=<xsl:value-of select="$View" /><xsl:value-of select="$folderUrlAdditionalQueryString"/>','TRUE','FALSE','<xsl:value-of select="$thisNode/@File_x0020_Type.url" />','<xsl:value-of select="$thisNode/@File_x0020_Type.progid" />','<xsl:value-of select="$XmlDefinition/List/@DefaultItemOpen" />','<xsl:value-of select="$thisNode/@HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon" />','<xsl:value-of select="$thisNode/@HTML_x0020_File_x0020_Type" />','<xsl:value-of select="$thisNode/@serverurl.progid" />','<xsl:value-of select="$thisNode/@CheckoutUser.id" />','<xsl:value-of select="$Userid" />','<xsl:value-of select="$XmlDefinition/List/@ForceCheckout" />','<xsl:value-of select="$thisNode/@IsCheckedoutToLocal" />','<xsl:value-of select="$thisNode/@PermMask" />');
</xsl:variable>
<a onfocus="OnLink(this)" href="{$FolderURL}">
<xsl:choose>
<xsl:when test="$IncludeOnClick = '1'">
<xsl:attribute name="onmousedown">
<xsl:value-of select="$OnMouseDownJS"/>
</xsl:attribute>
<xsl:attribute name="onclick">
<xsl:value-of select="$OnClickJS"/>
</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:value-of select="$thisNode/@FileLeafRef" />
<xsl:choose>
<xsl:when test="$ShowAccessibleIcon">
<img src="/_layouts/images/blank.gif" class="ms-hidden" border="0" width="1" height="1" alt="{$idPresEnabled}" />
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="OnClickJS">
javascript:EnterFolder("<xsl:value-of select="$PagePathFinal" />RootFolder=" + escapeProperly("<xsl:value-of select="$thisNode/@FileRef" />") + '<xsl:value-of select="$ShowWebPart" />&FolderCTID=<xsl:value-of select="$thisNode/@ContentTypeId" />&View=<xsl:value-of select="$View" /><xsl:value-of select="$folderUrlAdditionalQueryString" />');return false;
</xsl:variable>
<a onfocus="OnLink(this)" href="{$FolderURL}">
<xsl:choose>
<xsl:when test="$IncludeOnClick = '1'">
<xsl:attribute name="onclick">
<xsl:value-of select="$OnClickJS"/>
</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:value-of select="$thisNode/@FileLeafRef" />
<xsl:choose>
<xsl:when test="$ShowAccessibleIcon">
<img src="/_layouts/images/blank.gif" class="ms-hidden" border="0" width="1" height="1" alt="{$idPresEnabled}" />
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</a>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<a onfocus="OnLink(this)" href="{$thisNode/@FileRef}" onmousedown="return VerifyHref(this,event,'{$XmlDefinition/List/@DefaultItemOpen}','{$thisNode/@HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon}','{$thisNode/@serverurl.progid}')"
onclick="return DispEx(this,event,'TRUE','FALSE','{$thisNode/@File_x0020_Type.url}','{$thisNode/@File_x0020_Type.progid}','{$XmlDefinition/List/@DefaultItemOpen}','{$thisNode/@HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon}','{$thisNode/@HTML_x0020_File_x0020_Type}','{$thisNode/@serverurl.progid}','{$thisNode/@CheckoutUser.id}','{$Userid}','{$XmlDefinition/List/@ForceCheckout}','{$thisNode/@IsCheckedoutToLocal}','{$thisNode/@PermMask}')">
<xsl:value-of select="/dsQueryResponse/Rows/Row[1]" />
<xsl:value-of select="$thisNode/@FileLeafRef.Name" /></a>
<xsl:if test="$thisNode/@Created_x0020_Date.ifnew='1'">
<xsl:call-template name="NewGif">
<xsl:with-param name="thisNode" select="$thisNode"/>
</xsl:call-template>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="FieldRef_Text_body.Txt_x0020_Doc_x0020_Ref" ddwrt:dvt_mode="body" match ="FieldRef[@Name='Txt_x0020_Doc_x0020_Ref']" mode="Text_body" ddwrt:ghost="" xmlns:ddwrt2="urn:frontpage:internal">
<xsl:param name="thisNode" select="."/>
<!--- This is the field I wish to change --->
<xsl:value-of select="$thisNode/@Txt_x0020_Doc_x0020_Ref[contains(.,'Test')]"/>
</xsl:template></xsl:stylesheet></Xsl>
</WebPartPages:XsltListViewWebPart>
</ZoneTemplate></WebPartPages:WebPartZone>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderBodyAreaClass" runat="server">
<style type="text/css">
.ms-bodyareaframe {
padding: 0px;
}
</style>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderPageDescription" runat="server">
<SharePoint:ListProperty CssClass="ms-listdescription" Property="Description" runat="server"/>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderCalendarNavigator" runat="server">
<SharePoint:SPCalendarNavigator id="CalendarNavigatorId" runat="server"/>
<ApplicationPages:CalendarAggregationPanel id="AggregationPanel" runat="server"/>
</asp:Content>
</code>