将作者与SharePoint XSLT中的UserID进行比较

时间:2009-07-15 18:07:05

标签: sharepoint xslt sharepoint-2007 web-parts

我有一个简单的DataFormWebPart,我正在使用XSLT来呈现列表的内容。我想将每个列表项的@Author字段与当前用户进行比较,但以下内容不会评估为true:

在XSL的标题中:

<xsl:param name="UserID" />

并在评估行的模板中:

<xsl:value-of select="@Author" /> 
<xsl:if test="@AuthorID = $UserID">(you)</xsl:if>

我有@Author和$ UserID的值:

  • @Author呈现为其用户个人资料的超链接
  • $ UserID呈现为相同的文本,但没有超链接。

我可以使用什么表达式来获取用户配置文件的非超链接值?

2 个答案:

答案 0 :(得分:1)

快速获胜:

<xsl:value-of select="contains(@Author,concat('&gt;',$UserID,'&lt;'))" />

答案 1 :(得分:1)

应该参考

https://sharepoint.stackexchange.com/questions/21202/custom-form-does-not-display-created-by-value

<tr> 
<td valign="top" class="ms-formlabel"><nobr>Created by</nobr></td> 
<td valign="top" class="ms-formbody"> 
    <SharePoint:CreatedModifiedInfo ControlMode="Display" runat="server"> 
    <CustomTemplate> 
        <SharePoint:FormField FieldName="Author" runat="server" ControlMode="Display" DisableInputFieldLabel="true" /><br/> 
        <SharePoint:FieldValue FieldName="Modified" runat="server" ControlMode="Display" DisableInputFieldLabel="true"/> 
    </CustomTemplate> 
    </SharePoint:CreatedModifiedInfo> 
</td>