Ad

Compare Author To UserID In SharePoint XSLT

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?

Ad

Answer

Found a quick win:

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