【问题标题】:Compare Author to UserID in SharePoint XSLT在 SharePoint XSLT 中将作者与用户 ID 进行比较
【发布时间】:2010-11-11 02:30:16
【问题描述】:

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

在 XSL 的标题中:

<xsl:param name="UserID" />

在评估行的模板中:

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

我有 @Author 和 $UserID 的值:

  • @Author 呈现为其用户配置文件的超链接
  • $UserID 呈现为相同的文本,但没有超链接。

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

【问题讨论】:

  • 你能发布@Author$UserID的内容的例子吗?
  • @Author = 姓,名 $UserId = 姓,名

标签: sharepoint xslt sharepoint-2007 web-parts


【解决方案1】:

快速获胜:

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

【讨论】:

  • 如果格式真的如您所描述的那样,那就是尽可能接近了。 +1
【解决方案2】:

应该参考

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> 

【讨论】:

    猜你喜欢
    • 2012-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-29
    相关资源
    最近更新 更多