我在SharePoint2010中遇到XSLT代码问题。我对XSLT不是很熟悉,但我认为,我能够阅读代码。从SharePoint查询中,我得到了以下XML代码:
<Result>
<id>2</id>
<workid>160</workid>
<rank>67119018</rank>
<title>Angebot.pdf</title>
<author_multival>User, Name</author_multival>
<author>User, Name</author>
<size>440631</size>
<url>http://portal.url.de/sites/IT/Projects/Angebot.pdf</url>
<urlEncoded>http%3A%2F%2Fportal%2Eurl%2Ede%2Fsites%2FIT%2FProjects%2FAngebot%2Epdf</urlEncoded>
<description></description>
<write>21.03.2014</write>
<sitename>http://portal.url.de/sites/IT/Projects</sitename>
<collapsingstatus>0</collapsingstatus>
<hithighlightedsummary>User, Name <ddd /> <c0>SharePoint</c0>:Z-Drive <ddd /> Costs</hithighlightedsummary>
<hithighlightedproperties>
<HHTitle>Angebot.pdf</HHTitle>
<HHUrl>http://portal.url.de/sites/IT/Projects/Angebot.pdf</HHUrl>
</hithighlightedproperties>
<contentclass>STS_ListItem_DocumentLibrary</contentclass>
<isdocument>True</isdocument>
<picturethumbnailurl></picturethumbnailurl>
<serverredirectedurl></serverredirectedurl>
<sharepoint-invalid>False</sharepoint-invalid>
<fileextension_multival>PDF</fileextension_multival>
<fileextension>PDF</fileextension>
<ows_metadatafacetinfo>Projectx0020Name|Project Name|o3PIYhfa0kOegAKxi60qtQ==|S7ZoMTb2ikCAhuSFlC+sGA==|#43318cf9-39f5-461c-a4d0-bd2653612092|SharePoint:Z-Drive;#Projectx0020Documentx0020Category0|Project Document Category|o3PIYhfa0kOegAKxi60qtQ==|zRewJpp710mnJ0bWknAb2Q==|#d8f09524-a0dc-4324-97c3-1d566e4af75f|Costs;#</ows_metadatafacetinfo>
<popularsocialtags />
<imageurl imageurldescription="">/_layouts/images/pdf16.gif</imageurl>
现在我需要检查的值
<sharepoint-invalid>False</sharepoint-invalid>
在XSLT中。我尝试了以下代码,但它不起作用。我不知道如何正确检查布尔值,因为在搜索中总是显示"Valid"。
这是我的XSLT代码:
<xsl:choose>
<xsl:when test="$SharePoint-Invalid = 'True'">
<span style="color:#EF1317;font-weight:bold;">Invalid</span>
</xsl:when>
<xsl:otherwise>
<span style="color:#199039;font-weight:bold;">Valid</span>
</xsl:otherwise> </xsl:choose>
有人能帮忙吗?提前谢谢。
我想明白了。这是代码:
<xsl:choose>
<xsl:when test="sharepoint-invalid = 'True'">
<span style="color:#EF1317;font-weight:bold;">Document Invalid</span>
</xsl:when>
<xsl:otherwise>
<span style="color:#199039;font-weight:bold;">Document Valid</span>
</xsl:otherwise>
</xsl:choose>
问题是,如果我理解正确的话,我检查了一个参数和值本身。此外,变量必须是小写字母才能进行测试。