2012-12-10 48 views
0

我想知道有没有人可以帮忙。Sharepoint Xpath包含问题

我是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以下是共享点设计器中页面的全部内容。

我希望它做的是删除重复的命名值并显示前值只有IE浏览器

当前列表

  • 测试1
  • 测试1
  • 你好1
  • 罗伯特1
  • 我想要什么

  • 测试1
  • 你好1
  • 罗伯特·1
  • 只给在SharePoint列表的目的更多的信息。它是一个存储输入表单的表单库,所有表单都被提交,因此每个版本都被保存,下面的视图的目的是仅显示表单的最新版本,然后我将看到另一个视图,它将显示其他版本。

    请找到下面SharePoint Designer中的完整代码:

    <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() &gt;= $FirstRow and position() &lt;= $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"/>&amp;FolderCTID=<xsl:value-of select="$thisNode/@ContentTypeId" />&amp;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,&quot;<xsl:value-of select="$PagePathFinal" />RootFolder=&quot; + escapeProperly(&quot;<xsl:value-of select="$thisNode/@FileRef" />&quot;) + '<xsl:value-of select="$ShowWebPart" />&amp;FolderCTID=<xsl:value-of select="$thisNode/@ContentTypeId" />&amp;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(&quot;<xsl:value-of select="$PagePathFinal" />RootFolder=&quot; + escapeProperly(&quot;<xsl:value-of select="$thisNode/@FileRef" />&quot;) + '<xsl:value-of select="$ShowWebPart" />&amp;FolderCTID=<xsl:value-of select="$thisNode/@ContentTypeId" />&amp;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> 
    
    +0

    你能给出一个你正在使用的XML的例子和你期望的输出类型吗? –

    +0

    @Ian - 感谢您的回复。这里是从共享点列表 \t Matt

    +0

    我想要它做的是隐藏行中的重复值。 目前我有一个看起来像这样 测试1个 测试列表1 你好1 新的列表 测试1 你好1 – Matt

    回答

    0

    在表的SELECT语句改变 “AllRows” select语句下面

    这一操作将只显示一个结果使用相同的文档名称,然后在xml中添加如下所示的order by子句以显示最新结果。

    <Query> 
           <OrderBy> 
            <FieldRef Name="Modified" Ascending="FALSE"/> 
           </OrderBy> 
           <GroupBy> 
           </GroupBy> 
          </Query>