在SharePoint Designer 2010中编辑Sharepoint 2010资源库视图

时间:2011-03-02 18:24:12

标签: xml xslt sharepoint-2010 sharepoint-designer

我正在尝试对缩略图视图进行一些更改,缩略图视图是SharePoint 2010中数字资源库的一部分。从库功能区我选择“在SharePoint Designer中修改视图”。在进行所需的更改并保存后,然后从站点刷新库视图,我在页面上收到错误,指向我回到Sharepoint Designer。

当返回到SharePoint Designer时,当它尝试重新加载它显示的现在自定义的XsltListViewWebPart时,会出现以下错误...

Web部件没有有效的XSLT样式表:错误:结束标记'xsl:when'与开始标记'xsl:value-of'

不匹配

任何帮助/指针将不胜感激。在此先感谢,XML如下:

<WebPartPages:XsltListViewWebPart runat="server" Description="" PartOrder="2" Default="TRUE" HelpLink="" AllowRemove="True" IsVisible="True" AllowHide="True" UseSQLDataSourcePaging="True" ExportControlledProperties="False" IsIncludedFilter="" DataSourceID="" Title="Test Assets" ViewFlag="25165829" AllowConnect="True" DisplayName="Thumbnails" PageType="PAGE_DEFAULTVIEW" FrameState="Normal" PageSize="-1" PartImageLarge="" AsyncRefresh="False" ExportMode="NonSensitiveData" Dir="Default" DetailLink="/Test Assets" ShowWithSampleData="False" ListId="83218135-042c-4c26-9ec8-b66337739345" ListName="{83218135-042C-4C26-9EC8-B66337739345}" FrameType="Default" PartImageSmall="" IsIncluded="True" SuppressWebPartChrome="False" AllowEdit="True" ViewGuid="{8A47238D-DA6C-42C0-B0F8-74BC97140455}" AutoRefresh="False" AutoRefreshInterval="60" AllowMinimize="True" WebId="00000000-0000-0000-0000-000000000000" ViewContentTypeId="0x" InitialAsyncDataFetch="False" GhostedXslLink="AssetPicker.xsl" MissingAssembly="Cannot import this Web Part." HelpMode="Modeless" ID="g_8a47238d_da6c_42c0_b0f8_74bc97140455" ConnectionID="00000000-0000-0000-0000-000000000000" AllowZoneChange="True" TitleUrl="/Test Assets" ManualRefresh="False" __MarkupType="vsattributemarkup" __WebPartId="{8A47238D-DA6C-42C0-B0F8-74BC97140455}" __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="Viewing" Location="Form(APDView)" DefaultValue="Thumbs" />
    <ParameterBinding Name="ThumbStyle" Location="Form(APDThumbNailStyle)" DefaultValue="medium" />
    <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
</ParameterBindings>
<XmlDefinition>
    <View Name="{8A47238D-DA6C-42C0-B0F8-74BC97140455}" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" Type="HTML" DisplayName="Thumbnails" Url="/Test Assets/Forms/Thumbnails.aspx" Level="1" BaseViewID="40" ContentTypeID="0x" ImageUrl="/_layouts/images/dlicon.png">
        <Query>
            <OrderBy>
                <FieldRef Name="LinkFilename"/>
            </OrderBy>
        </Query>
        <ViewFields>
            <FieldRef Name="LinkFilename"/>
            <FieldRef Name="Title"/>
            <FieldRef Name="ContentType"/>
            <FieldRef Name="_ModerationStatus"/>
            <FieldRef Name="PreviewOnForm"/>
            <FieldRef Name="ThumbnailOnForm"/>
            <FieldRef Name="PublishingStartDate"/>
            <FieldRef Name="PublishingExpirationDate"/>
            <FieldRef Name="Modified"/>
            <FieldRef Name="Editor"/>
        </ViewFields>
        <RowLimit Paged="TRUE">20</RowLimit>
        <ViewStyle ID="0" DisplayName="Thumbnails"/>
        <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/AssetPicker.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">&apos;</xsl:param>
        <xsl:template name="clientPageArray" ddwrt:ghost="" xmlns:ddwrt2="urn:frontpage:internal">
            <xsl:choose>
                <xsl:when test ="$Picking='yes'">
                    <input type="hidden" name="assetpicking">
                        <xsl:attribute name="value">
        <xsl:value-of select="$Picking"/>
      </xsl:attribute>
                        <input type="hidden" name="webpartclientid" xsl:exclude-result-prefixes="SharePoint">
                            <xsl:attribute name="value">
        <xsl:value-of select="$WebPartClientID"/>
      </xsl:attribute>
                            <input type="hidden" name="listid">
                                <xsl:attribute name="value">
        <xsl:value-of select="$List"/>
      </xsl:attribute>
                                <input type="hidden" name="thumbnailsize">
                                    <xsl:attribute name="value">
        <xsl:value-of select="$ThumbnailSize"/>
      </xsl:attribute>
                                    <input type="hidden" name="webimagewidth">
                                        <xsl:attribute name="value">
        <xsl:value-of select="$WebImageWidth"/>
      </xsl:attribute>
                                        <input type="hidden" name="webimageheight">
                                            <xsl:attribute name="value">
        <xsl:value-of select="$WebImageHeight"/>
      </xsl:attribute>
                                            <input type="hidden" name="canedit">
                                                <xsl:attribute name="value">
        <xsl:value-of select="$CanEdit"/>
      </xsl:attribute>
                                                <script>
      if(&quot;function&quot; == typeof(AssetPickerPageCache)) g_AssetPickerPageCache = new AssetPickerPageCache();
      if(&quot;function&quot; == typeof(AssetPickerXslContext)) g_AssetPickerXslContext = new AssetPickerXslContext();
    </script>
                                            </xsl:when>
                                            <xsl:otherwise>
                                                <script type="text/javascript">
      var g_Rev = <xsl:value-of select="concat($squote,ddwrt:GetCurrentBuildVersion(),$squote)"/>;
      var g_AllowSilverlightPrompt = <xsl:value-of select="ddwrt:AllowSilverlightPrompt()"/>;
      <![CDATA[
      var g_APD_ScriptsLoaded = 0;
      var g_APD_CsssLoaded = 0;
      function APD_CallbackWssView(who)
      {
        if(&quot;function&quot; == typeof(window.status)) window.status(&apos;Boot Strap Callback from &apos; + who);
      }
      function SmtAddWindowLoadEvent(handlerFunc)
      {
        if (window.attachEvent)
        {
            window.attachEvent(&quot;onload&quot;, handlerFunc);
        }
        else if (window.addEventListener)
        {
            window.addEventListener(&quot;load&quot;, handlerFunc, false);
        }
      }
      function APD_EnsureLoadHandlers()
      {
        EnsureScript(&quot;CMSSiteManager.js&quot;, typeof(AssetPickerPageCache), APD_LoadHandlers);
      }
      function APD_LoadHandlers()
      {
        g_AssetPickerPageCache = new AssetPickerPageCache();
        g_AssetPickerXslContext = new AssetPickerXslContext();
        EnsureScript(&quot;AssetPickers.js&quot;, typeof(AP_IsEmpty), APD_InitializeAssetPickerElements);
      }
      function APD_SimpleCacheControl()
      {
        return g_Rev;
      }
      function APD_AddStyleSheet(hrefValue)
      {
        if (!document.getElementsByTagName
        || !(document.createElement || document.createElementNS)) return;
        var head = document.getElementsByTagName(&quot;head&quot;)[0];
        var link = document.createElement(&quot;link&quot;);
        link.setAttribute(&apos;type&apos;, &apos;text/css&apos;);
        link.setAttribute(&apos;rel&apos;, &apos;stylesheet&apos;);
        link.setAttribute(&apos;media&apos;, &apos;screen&apos;);
        var rev = APD_SimpleCacheControl();
        var url = hrefValue + &quot;?rev=&quot;+rev;
        link.setAttribute(&apos;href&apos;, url);
        head.appendChild(link);
        return false;
      }
      function APD_AddScript(hrefValue)
      {
        if (!document.getElementsByTagName
        || !(document.createElement || document.createElementNS)) return;
        var loc = document.getElementsByTagName(&quot;head&quot;)[0];
        var rev = APD_SimpleCacheControl();
        var link = document.createElement(&quot;script&quot;);
        link.setAttribute(&apos;type&apos;, &apos;text/javascript&apos;);
        var url = hrefValue + &quot;?rev=&quot;+rev;
        link.setAttribute(&apos;src&apos;, url);
        loc.appendChild(link);
        link.onload = function () 
        {
          g_APD_ScriptsLoaded++;
          if(&quot;function&quot; == typeof(window.status)) window.status(&quot;Script #&quot; + g_APD_ScriptsLoaded + &quot; loaded&quot;);
        }
        return false;
      }
    ]]>
      if(document.g_APD_isFFScriptLoaded == undefined) 
      {
      APD_AddStyleSheet(<xsl:value-of select="concat($squote,$StylePath,'/portal.css',$squote)"/>);
      APD_AddScript(<xsl:value-of select="concat($squote,$LocScriptPath,'/CMSSiteManager.js',$squote)"/>);
      APD_AddScript(<xsl:value-of select="concat($squote,$LocScriptPath,'/AssetPickers.js',$squote)"/>);
      APD_AddScript(<xsl:value-of select="concat($squote,$NonLocScriptPath,'/MediaPlayer.js',$squote)"/>);
      SmtAddWindowLoadEvent(APD_EnsureLoadHandlers);
      document.g_APD_isFFScriptLoaded = true;
      }
    </script>
                                            </xsl:otherwise>
                                        </xsl:choose>
                                    </xsl:template>
                                    <xsl:template mode="Item" match="Row[../../@BaseViewID='40']" ddwrt:ghost="" xmlns:ddwrt2="urn:frontpage:internal">
                                        <xsl:param name="Fields" select="."/>
                                        <xsl:param name="Collapse" select="."/>
                                        <xsl:param name="Position" select="1"/>
                                        <xsl:param name="Last" select="1"/>
                                        <xsl:variable name="thisNode" select="."/>
                                        <xsl:variable name="imageId" select="concat('tiledimage_',$thisNode/@ID)"/>
                                        <li>
                                            <xsl:attribute name="id">
        <xsl:value-of select="$imageId"/>
      </xsl:attribute>
                                            <xsl:attribute name="style">
        <xsl:if test="$Collapse">
          <xsl:value-of select="$CBXStyle"/>
        </xsl:if>
      </xsl:attribute>
                                            <div>
                                                <xsl:attribute name="class">
          <xsl:value-of select="$StyleToApply"/>
        </xsl:attribute>
                                                <xsl:call-template name="RenderThumbnail">
                                                    <xsl:with-param name="thisNode" select="$thisNode"/>
                                                    <xsl:with-param name="subDir" select="'_t'"/>
                                                    <xsl:with-param name="resizeSquareSideLength" select="100"/>
                                                </xsl:call-template>
                                            </div>
                                            <div>
                                                <xsl:attribute name="class">ms-assetpicker-tiled-mediumprops</xsl:attribute>
                                                <xsl:call-template name="ItemData"/>
                                                <xsl:choose>
                                                    <xsl:when test="$Fields[@Name='Title']/following-sibling::FieldRef[@Name='LinkFilename']">
                                                        <xsl:apply-templates select="$Fields[@Name='Title']" mode="PrintFieldWithECB">
                                                            <xsl:with-param name="thisNode" select="$thisNode"/>
                                                        </xsl:apply-templates>
                                                    </xsl:when>
                                                    <xsl:otherwise>
                                                        <xsl:call-template name="LinkFilenameNoMenuAP">
                                                            <xsl:with-param name="thisNode" select="$thisNode"/>
                                                            <xsl:with-param name="ShowNonContainerLinkOnly" select="1"/>
                                                        </xsl:call-template>
                                                    </xsl:otherwise>
                                                </xsl:choose>
                                            </div>
                                            <dl id="itemimages{generate-id()}">
                                                <xsl:attribute name="class">
          <xsl:value-of select="$StyleForHiding"/>
        </xsl:attribute>
                                                <xsl:for-each select="$Fields[not(@Name='ThumbnailOnForm') and not(@Name='PreviewOnForm') and not(@Name='DocIcon') and not(@Name='Title')]">
                                                    <dd>
                                                        <xsl:attribute name="id">
              <xsl:value-of select="concat(@Name,'_',$thisNode/@ID)"/>
            </xsl:attribute>
                                                        <xsl:attribute name="class">
              <xsl:value-of select="$StyleForHiding"/>
            </xsl:attribute>
                                                        <span>
                                                            <xsl:value-of select="@DisplayName"/>
                                                            <xsl:apply-templates select="." mode="PrintFieldWithECB">
                                                                <xsl:with-param name="thisNode" select="$thisNode" />
                                                            </xsl:apply-templates>
                                                        </span>
                                                    </dd>
                                                </xsl:for-each>
                                            </dl>
                                        </li>
                                    </xsl:template>
                                    <xsl:template name="ItemData" mode="ClientData" match="Row" ddwrt:ghost="" xmlns:ddwrt2="urn:frontpage:internal">
                                        <xsl:param name ="thisNode" select="."/>
                                        <xsl:variable name="imageId" select="concat('tiledimage_',$thisNode/@ID)"/>
                                        <input type="checkbox">
                                            <xsl:attribute name="id">
          <xsl:value-of select="$thisNode/@ID" /></xsl:attribute>
                                            <xsl:attribute name="name">
          <xsl:value-of select="'ImageItem'"/>
        </xsl:attribute>
                                            <xsl:attribute name="iid">
          <xsl:value-of select="$ViewCounter"/>,<xsl:value-of select="$thisNode/@ID" />,<xsl:value-of select="$thisNode/@FSObjType" /></xsl:attribute>
                                            <xsl:attribute name="style">
            <xsl:choose>
                <xsl:when test="$Picking='yes'">
        <xsl:value-of select="$CBXStyle" />
    </xsl:when>
                <xsl:otherwise>display:inline;</xsl:otherwise>
            </xsl:choose>
    </xsl:attribute>
                                            <xsl:attribute name="value">
            <xsl:call-template name="clientData">
                <xsl:with-param name="id" select="$imageId"/>
                <xsl:with-param name="canEdit">
                    <xsl:variable name="hasRight">
                        <xsl:call-template name="IfHasRight">
                            <xsl:with-param name="thisNode" select ="$thisNode"/>
                        </xsl:call-template>
              </xsl:variable>
              <xsl:value-of select="number($hasRight)"/>
            </xsl:with-param>
                <xsl:with-param name="previewExists" select="$thisNode/@PreviewExists.value"/>
                <xsl:with-param name="thumbnailExists" select="$thisNode/@ThumbnailExists.value"/>
                <xsl:with-param name="alternateThumbnailUrl" select="$thisNode/@AlternateThumbnailUrl"/>
                <xsl:with-param name="parentId" select="$ParentId"/>
                <xsl:with-param name="propsUrl" select="concat($FORM_DISPLAY, '&amp;ID=',$thisNode/@ID)"/>
                <xsl:with-param name ="dwnlUrl" select ="concat($HttpVDir,'/_layouts/Download.aspx?SourceUrl=',$thisNode/@FileRef)"/>
                <xsl:with-param name ="editUrl" select ="concat($FORM_EDIT, '&amp;ID=',$thisNode/@ID)"/>
                <xsl:with-param name ="navUrl">
              <xsl:value-of select="$thisNode/@FileRef"/>
            </xsl:with-param>
                <xsl:with-param name ="imageHeight" select="$thisNode/@ImageHeight"/>
                <xsl:with-param name ="imageWidth" select="$thisNode/@ImageWidth"/>
                <xsl:with-param name="container">
                    <xsl:choose>
                        <xsl:when test="$thisNode/@FSObjType='1'">
                  <xsl:value-of select="'true'"/>
                </xsl:when>
                        <xsl:otherwise>
                  <xsl:value-of select="'false'"/>
                </xsl:otherwise>
                    </xsl:choose>
            </xsl:with-param>
                <xsl:with-param name="rootFolder">
                    <xsl:choose>
                        <xsl:when test="$thisNode/@FSObjType='1'">
                  <xsl:value-of select="$thisNode/@FileRef"/>
                </xsl:when>
                        <xsl:otherwise>
                  <xsl:value-of select="''"/>
                </xsl:otherwise>
                    </xsl:choose>
            </xsl:with-param>
                <xsl:with-param name="folderCTID">
                    <xsl:choose>
                        <xsl:when test="$thisNode/@FSObjType='1'">
                  <xsl:value-of select="$thisNode/@ContentTypeId"/>
                </xsl:when>
                        <xsl:otherwise>
                  <xsl:value-of select="''"/>
                </xsl:otherwise>
                    </xsl:choose>
            </xsl:with-param>
                <xsl:with-param name ="itemTitle">
                    <xsl:choose>
                        <xsl:when test="$thisNode/@Title != ''">
                  <xsl:value-of select="$thisNode/@Title"/>
                </xsl:when>
                        <xsl:otherwise>
                            <xsl:call-template name="getFileName">
                                <xsl:with-param name="FileNameAndExt" select="$thisNode/@FileLeafRef"/>
                            </xsl:call-template>
                </xsl:otherwise>
                    </xsl:choose>
            </xsl:with-param>
                <xsl:with-param name ="coutId_Loc" select="concat($thisNode/@CheckedOutUserId, '_', $thisNode/@IsCheckedoutToLocal)"/>
                <xsl:with-param name ="absUrl" select="concat($HttpHost,$thisNode/@FileRef)"/>
            </xsl:call-template>
        </xsl:attribute>
                                        </input>
                                    </xsl:template>
                                    <xsl:template match="FieldRef" name="LinkFilenameNoMenuAP" mode="Computed_LinkFilename_body" ddwrt:tag="a" ddwrt:ghost="" xmlns:ddwrt2="urn:frontpage:internal">
                                        <xsl:param name="thisNode" select="."/>
                                        <xsl:param name="ShowAccessibleIcon" select="0"/>
                                        <xsl:param name="ShowNonContainerLinkOnly" select="0"/>
                                        <xsl:choose>
                                            <xsl:when test="$Picking = 'yes' and $thisNode/@FSObjType != '1'">
                                                <a href="javascript:;">
                                                    <xsl:value-of select="$thisNode/@FileLeafRef.Name" />
                                                </a>
                                            </xsl:when>
                                            <xsl:when test="$thisNode/@FSObjType = '1' and ($Picking = 'yes' or $ShowNonContainerLinkOnly = '1')">
                                                <xsl:call-template name="LinkFilenameNoMenu">
                                                    <xsl:with-param name="thisNode" select="$thisNode"/>
                                                    <xsl:with-param name="ShowAccessibleIcon" select="$ShowAccessibleIcon"/>
                                                    <xsl:with-param name="IncludeOnClick">
                    <xsl:choose>
                        <xsl:when test="$Picking = 'yes'">0</xsl:when>
                        <xsl:otherwise>1</xsl:otherwise>
                    </xsl:choose>
        </xsl:with-param>
                                                </xsl:call-template>
                                            </xsl:when>
                                            <xsl:otherwise>
                                                <xsl:choose>
                                                    <xsl:when test="$ShowNonContainerLinkOnly = '1'">
                                                        <a href="{$thisNode/@FileRef}">
                                                            <xsl:value-of select="$thisNode/@Title" />
                                                        </a>
                                                    </xsl:when>
                                                    <xsl:otherwise>
                                                        <xsl:call-template name="LinkFilenameNoMenu">
                                                            <xsl:with-param name="thisNode" select="$thisNode"/>
                                                            <xsl:with-param name="ShowAccessibleIcon" select="$ShowAccessibleIcon"/>
                                                        </xsl:call-template>
                                                    </xsl:otherwise>
                                                </xsl:choose>
                                            </xsl:otherwise>
                                        </xsl:choose>
                                    </xsl:template>
                                </xsl:stylesheet>
                            </Xsl>
                        </WebPartPages:XsltListViewWebPart>

1 个答案:

答案 0 :(得分:0)

您应该关闭input这样的文字元素:

<input type="hidden" name="assetpicking">
    <xsl:attribute name="value">
        <xsl:value-of select="$Picking"/>
    </xsl:attribute>
</input>

事实上,当在运行时不计算属性名称时,最好使用AVT。像这样:

<input type="hidden" name="assetpicking" value="{$Picking}"/>