1

I've got a simple DataFormWebPart where I'm using XSLT to render out the contents of list. I want to compare the @Author field each list item to the current user, however the following won't evaluate to true:

in the header of the XSL:

<xsl:param name="UserID" />

and within the template that evaluates the rows:

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

I have values for both @Author and $UserID:

  • @Author renders as a hyperlink to their user-profile
  • $UserID renders as the same text, but without the hyperlink.

What expression can I use to get the non-hyperlink value of the user-profile?

bryanbcook
  • 16,210
  • 2
  • 40
  • 69

2 Answers2

1

Should refer

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> 

Community
  • 1
  • 1
1

Found a quick win:

<xsl:value-of select="contains(@Author,concat('&gt;',$UserID,'&lt;'))" />
bryanbcook
  • 16,210
  • 2
  • 40
  • 69