0

そこにいる誰かが助けてくれるのだろうか。

私は 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 ここでは、共有ポイント デザイナーのページのコンテンツ全体を示します。

私がやりたいことは、重複した命名値を削除し、最上位の値のみを表示することです

現在のリスト

  • テスト 1
  • テスト 1
  • こんにちは 1
  • ロバート 1
  • 私が欲しいもの

  • テスト 1
  • こんにちは 1
  • ロバート 1
  • 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() &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>
    
    4

    1 に答える 1

    0

    テーブルのselectステートメントで、「AllRows」selectステートメントを次のように変更します

    これにより、同じドキュメント名の結果が1つだけ表示され、次に示すようにxmlにorder by句を追加して、最新の結果を表示します。

        <Query>
                    <OrderBy>
                        <FieldRef Name="Modified" Ascending="FALSE"/>
                    </OrderBy>
                    <GroupBy>
                    </GroupBy>
                </Query>
    
    于 2012-12-17T11:38:27.727 に答える