1

我正在尝试确定项目的内容类型。我试过这个,但我认为 results.aspx webpart 中的 ContentType 以另一个名字而闻名。

<xsl:if contenttype="mycustomcontenttype"> 
 <xsl:Value-of select="contenttype" />
<xsl:if>
4

2 回答 2

1

您的 XSLT 格式错误。

没有这样的xsl:if属性被称为contenttype- 也没有<xsl:Value-of因为所有指令都区分大小写,并且应该是小写的。

你的代码应该是这样的......

<xsl:if test="contenttype='mycustomcontenttype'"> 
 <xsl:value-of select="contenttype" />
<xsl:if>
于 2012-07-20T17:40:27.583 回答
1

甚至这个单行(根本不使用条件):

<xsl:value-of select="contenttype[.='mycustomcontenttype']"/>
于 2012-07-21T03:49:23.700 回答