我认为我的 xslt 格式可能不正确 [英] I think my xslt may not be formatted correctly
问题描述
我正在尝试更改 searchResult.aspx 页面上文档链接"的图标.我在结果的 xslt 中添加了以下内容,但结果 webpart 永远不会呈现,这意味着代码已损坏.我试图按照 SP2007 文章 (http://msdn.microsoft.com/en-us/library/cc789805(v=office.12).aspx) 但我的环境是 SP 2010.请建议.
<xsl:if test="contenttype='LegalLinkedDocument'"><img align="absmiddle" src="_layouts/images/legalLinkedIcon.gif" border="0" alt="{imageurl/@imageurldescription}"/></xsl:if><img align="absmiddle" src="{imageurl}" border="0" alt="{imageurl/@imageurldescription}"/> 解决方案 我相信有一个错误会阻止使用 ContentType 元数据属性(请参阅 http://social.msdn.microsoft.com/Forums/en/sharepoint2010general/thread/cd059e1c-7af6-454c-8568-a22e7755ce8c)
您需要创建一个新的托管元数据属性并将其映射到 ows_ContentType 爬网属性(我称其为我的 CType),然后执行完整爬网(您可能需要先删除索引)以使该属性在搜索索引.
然后编辑搜索核心结果 web 部件并添加
到
之后的Fetched Properties(在Display Properties下)然后将您的 xml 更新为以下内容
<xsl:when test="ctype = 'LegalLinkedDocument'"><img align="absmiddle" src="_layouts/images/LegalLinkedDocument.gif" border="0" alt="{imageurl/@imageurldescription}"/></xsl:when><xsl:否则><img align="absmiddle" src="{imageurl}" border="0" alt="{imageurl/@imageurldescription}"/></xsl:否则></xsl:选择>
I am trying to change the icon for the "Link to Document" on the searchResult.aspx page. I added following to the xslt of the result but then the result webpart never renders meaning the code is broke. I tried to follow SP2007 article (http://msdn.microsoft.com/en-us/library/cc789805(v=office.12).aspx) but my environment is SP 2010. Please suggest.
<div class="srch-Icon" id="{concat($currentId,'_Icon')}">
<xsl:if test="contenttype='LegalLinkedDocument'">
<img align="absmiddle" src="_layouts/images/legalLinkedIcon.gif" border="0" alt="{imageurl/@imageurldescription}" />
</xsl:if>
<img align="absmiddle" src="{imageurl}" border="0" alt="{imageurl/@imageurldescription}" />
解决方案 I believe there is a bug that prevents the ContentType metadata property being used (see http://social.msdn.microsoft.com/Forums/en/sharepoint2010general/thread/cd059e1c-7af6-454c-8568-a22e7755ce8c)
You need to create a new managed metadata property and map it to the ows_ContentType crawled property (I called mine CType), after this do a full crawl (you may need to delete the index first) to have the property available in the search index.
Then edit the Search Core Results web part and add
<Column Name="CType"/>
to Fetched Properties (under Display Properties) after <columns>
Then update your xml to the following
<xsl:choose>
<xsl:when test="ctype = 'LegalLinkedDocument'">
<img align="absmiddle" src="_layouts/images/LegalLinkedDocument.gif" border="0" alt="{imageurl/@imageurldescription}" />
</xsl:when>
<xsl:otherwise>
<img align="absmiddle" src="{imageurl}" border="0" alt="{imageurl/@imageurldescription}" />
</xsl:otherwise>
</xsl:choose>
这篇关于我认为我的 xslt 格式可能不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文