我创建了一个 CQWP,其中列出了文档图标、标题、作者、签出到和上次修改时间。如果我将其指向单个文档库,则一切正常,但是当我将其指向子网站时,为了查看所有库中的文档,我获得了图标和标题,但没有其他内容。我错过了什么?这是我在ItemStyle.xsl中的代码:
<xsl:if test="count(preceding-sibling::*)=0">
<div style="float:left; width:32px;"> </div>
<div style="float:left; width:15%; padding-right:15px;">Name</div>
<div style="float:left; width:10%; padding-right:15px;">Created By</div>
<div style="float:left; width:10%; padding-right:15px;">Checked Out</div>
<div style="float:left;">Last Modified</div>
</xsl:if>
<div class="item link-item">
<xsl:if test="string-length(@DocumentIconImageUrl) != 0">
<div class="image-area-left" style="width:25px;">
<img class="image" src="{@DocumentIconImageUrl}" title="" />
</div>
</xsl:if>
<div class="link-item">
<xsl:if test="count(preceding-sibling::*)=0">
</xsl:if>
<xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate"/>
<div style="float:left; width:15%; padding-right:15px;">
<a href="{$SafeLinkUrl}" title="{@LinkToolTip}">
<xsl:if test="$ItemsHaveStreams = 'True'">
<xsl:attribute name="onclick">
<xsl:value-of select="@OnClickForWebRendering"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$ItemsHaveStreams != 'True' and @OpenInNewWindow = 'True'">
<xsl:attribute name="onclick">
<xsl:value-of disable-output-escaping="yes" select="$OnClickTargetAttribute"/>
</xsl:attribute>
</xsl:if>
<xsl:value-of select="$DisplayTitle"/>
</a>
</div>
<div style="float:left; width:10%; padding-right:15px;">
<xsl:value-of select="@Author" />
</div>
<div style="float:left; width:10%; padding-right:15px;">
<xsl:choose>
<xsl:when test="string-length(@CheckoutUser) = 0">
Checked In
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@CheckoutUser" />
</xsl:otherwise>
</xsl:choose>
</div>
<div style="float:left;"><xsl:value-of select="ddwrt:FormatDate(@Modified, 1033, 2)" /></div>
</div>
</div>
这是我的 CQWP 中的代码:
<metaData>
<type name="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart, Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
</metaData>
<data>
<properties>
<property name="Filter1ChainingOperator" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+FilterChainingOperator, Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">And</property>
<property name="FilterOperator1" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+FilterFieldQueryOperator, Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">Eq</property>
<property name="Direction" type="direction">NotSet</property>
<property name="FilterOperator3" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+FilterFieldQueryOperator, Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">Eq</property>
<property name="GroupByDirection" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+SortDirection, Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">Desc</property>
<property name="DataSourceID" type="string" />
<property name="ChromeState" type="chromestate">Normal</property>
<property name="SystemViewFields" type="string" />
<property name="ListName" type="string" />
<property name="FilterDisplayValue3" type="string" />
<property name="FilterDisplayValue2" type="string" />
<property name="FilterDisplayValue1" type="string">In Progress</property>
<property name="FilterField1" type="string">{6e2d20e1-63ca-44c4-a57f-1f934d7f92ab}</property>
<property name="Description" type="string">Displays a dynamic view of content from your site.</property>
<property name="DataColumnRenames" type="string" />
<property name="MissingAssembly" type="string">Cannot import this Web Part.</property>
<property name="PageSize" type="int">-1</property>
<property name="ViewContentTypeId" type="string" />
<property name="ParameterBindings" type="string" />
<property name="HelpUrl" type="string" />
<property name="AdditionalFilterFields" type="string" />
<property name="DataMappingViewFields" type="string">{94f89715-e097-4e8b-ba79-ea02aa8b7adb},Lookup;{b9e6f3ae-5632-4b13-b636-9d1a2bd67120},Computed;{543bc2cf-1f30-488e-8f25-6fe3b689d9ac},Image;{fa564e0f-0c70-4ab9-b863-0177e6ddd247},Text;{691b9a4b-512e-4341-b3f1-68914130d5b2},Text;{1df5e554-ec7e-46a6-901d-d85a3881cb18},User;</property>
<property name="Title" type="string">In Progress</property>
<property name="FeedDescription" type="string" />
<property name="UseCache" type="bool">True</property>
<property name="XslLink" type="string" null="true" />
<property name="AutoRefresh" type="bool">False</property>
<property name="Filter1IsCustomValue" type="bool">False</property>
<property name="FireInitialRow" type="bool">True</property>
<property name="FilterValue3" type="string" />
<property name="SortByFieldType" type="string">DateTime</property>
<property name="ManualRefresh" type="bool">False</property>
<property name="HelpMode" type="helpmode">Modeless</property>
<property name="AllowConnect" type="bool">True</property>
<property name="ItemStyle" type="string">WithDocIcon</property>
<property name="SampleData" type="string"><dsQueryResponse>
<Rows>
<Row Title="Item 1" LinkUrl="http://Item1" Group="Group Header" __begincolumn="True" __begingroup="True" />
<Row Title="Item 2" LinkUrl="http://Item2" __begincolumn="False" __begingroup="False" />
<Row Title="Item 3" LinkUrl="http://Item3" __begincolumn="False" __begingroup="False" />
</Rows>
</dsQueryResponse></property>
<property name="FilterIncludeChildren2" type="bool">False</property>
<property name="XmlDefinitionLink" type="string" />
<property name="ServerTemplate" type="string">101</property>
<property name="TitleUrl" type="string" />
<property name="CommonViewFields" type="string">Modified,DateTime,;Modified By,User;Checked Out To, User;Check In Comment, Lookup;Author,User</property>
<property name="QueryOverride" type="string" />
<property name="DataSourcesString" type="string" />
<property name="DisplayName" type="string" />
<property name="ListGuid" type="string" />
<property name="DataFields" type="string" />
<property name="ShowWithSampleData" type="bool">False</property>
<property name="GroupByFieldType" type="string" />
<property name="Default" type="string" />
<property name="ViewFlags" type="Microsoft.SharePoint.SPViewFlags, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">None</property>
<property name="ContentTypeBeginsWithId" type="string" />
<property name="AllowHide" type="bool">True</property>
<property name="FeedEnabled" type="bool">False</property>
<property name="SortBy" type="string">{8c06beca-0777-48f7-91c7-6da68bc07b69}</property>
<property name="FilterByContextTerm" type="bool">False</property>
<property name="TitleIconImageUrl" type="string" />
<property name="PlayMediaInBrowser" type="bool">True</property>
<property name="ViewFlag" type="string">0</property>
<property name="Xsl" type="string"><xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cmswrt="http://schemas.microsoft.com/WebPart/v3/Publishing/runtime" exclude-result-prefixes="xsl cmswrt x" > <xsl:import href="/Style Library/XSL Style Sheets/Header.xsl" /> <xsl:import href="/Style Library/XSL Style Sheets/ItemStyle.xsl" /> <xsl:import href="/Style Library/XSL Style Sheets/ContentQueryMain.xsl" /> </xsl:stylesheet></property>
<property name="FilterField2" type="string" />
<property name="ChromeType" type="chrometype">TitleOnly</property>
<property name="CacheXslTimeOut" type="int">86400</property>
<property name="AdditionalGroupAndSortFields" type="string" />
<property name="UseSQLDataSourcePaging" type="bool">True</property>
<property name="Height" type="string" />
<property name="DataMappings" type="string">Author:|Modified:|Description:{691b9a4b-512e-4341-b3f1-68914130d5b2},ShortComment,Text;{1df5e554-ec7e-46a6-901d-d85a3881cb18},Author,User;|Title:{fa564e0f-0c70-4ab9-b863-0177e6ddd247},Title,Text;|CheckoutUser:|LinkUrl:{94f89715-e097-4e8b-ba79-ea02aa8b7adb},FileRef,Lookup;|ImageUrl:{b9e6f3ae-5632-4b13-b636-9d1a2bd67120},EncodedAbsThumbnailUrl,Computed;{543bc2cf-1f30-488e-8f25-6fe3b689d9ac},PublishingRollupImage,Image;|</property>
<property name="ListUrl" type="string" null="true" />
<property name="ShowUntargetedItems" type="bool">False</property>
<property name="AllowMinimize" type="bool">True</property>
<property name="GroupBy" type="string" />
<property name="FilterIncludeChildren1" type="bool">False</property>
<property name="BaseType" type="string" />
<property name="MainXslLink" type="string" />
<property name="AsyncRefresh" type="bool">False</property>
<property name="FilterValue1" type="string">In Progress</property>
<property name="FilterValue2" type="string" />
<property name="InitialAsyncDataFetch" type="bool">False</property>
<property name="AutoRefreshInterval" type="int">60</property>
<property name="Filter3IsCustomValue" type="bool">False</property>
<property name="GroupStyle" type="string">DefaultHeader</property>
<property name="AllowZoneChange" type="bool">True</property>
<property name="FilterIncludeChildren3" type="bool">False</property>
<property name="EnableOriginalValue" type="bool">False</property>
<property name="ItemLimit" type="int">15</property>
<property name="FilterType1" type="string">Choice</property>
<property name="UseCopyUtil" type="bool">False</property>
<property name="FilterType3" type="string" />
<property name="FilterType2" type="string" />
<property name="FilterOperator2" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+FilterFieldQueryOperator, Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">Eq</property>
<property name="PageType" type="Microsoft.SharePoint.PAGETYPE, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">PAGE_NORMALVIEW</property>
<property name="FilterByAudience" type="bool">False</property>
<property name="ItemXslLink" type="string" />
<property name="Hidden" type="bool">False</property>
<property name="WebUrl" type="string">~sitecollection/dmwdocs</property>
<property name="HeaderXslLink" type="string" />
<property name="CacheXslStorage" type="bool">True</property>
<property name="ListsOverride" type="string" />
<property name="SortByDirection" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+SortDirection, Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">Desc</property>
<property name="Filter2IsCustomValue" type="bool">False</property>
<property name="AllowEdit" type="bool">True</property>
<property name="FeedTitle" type="string" />
<property name="FilterField3" type="string" />
<property name="MediaPlayerStyleSource" type="string" null="true" />
<property name="DisplayColumns" type="int">1</property>
<property name="Filter2ChainingOperator" type="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart+FilterChainingOperator, Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">Or</property>
<property name="XmlDefinition" type="string" />
<property name="WebsOverride" type="string" />
<property name="AllowClose" type="bool">True</property>
<property name="ContentTypeName" type="string" />
<property name="ListId" type="System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">00000000-0000-0000-0000-000000000000</property>
<property name="ExportMode" type="exportmode">All</property>
<property name="NoDefaultStyle" type="string" />
<property name="ViewFieldsOverride" type="string" />
<property name="CatalogIconImageUrl" type="string" />
<property name="ListDisplayName" type="string" null="true" />
<property name="Width" type="string" />
</properties>
</data>
尝试编辑 Web 部件属性,如屏幕截图所示。CQWP在这里,我在"要显示的字段"部分中明确提到了列名称。请使用显示名称。就我而言,它没有显示作者(创建者)列。