2012-12-10 92 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>