This project is read-only.

GetUserNames returning only the first name

Jul 12, 2012 at 7:41 PM
Edited Jul 12, 2012 at 7:45 PM

I am using GetUserNames template and I have also included the dependencies i.e. GetUserName template. 

Here is how I am calling the template. 


<td class="ms-vb">
	<xsl:call-template name="GetUserNames">
		<xsl:with-param name="People" select="@Recruiters"></xsl:with-param>
		<xsl:with-param name="Separator" select="', '"/>

Any idea why it's only returning only the first name? 

If I select the field only @Recruiters using the code

<xsl:value-of select="@Recruiters"></xsl:value-of>

without using template here is what I am getting. 

<span class="ms-imnSpan"><a onclick="GoToLink(this);return false;" href="/sites/HBdesign/_layouts/userdisp.aspx?ID=1">User A</a></span>; <span class="ms-imnSpan"><a onclick="GoToLink(this);return false;" href="/sites/HBdesign/_layouts/userdisp.aspx?ID=33">User B</a></span>; <span class="ms-imnSpan"><a onclick="GoToLink(this);return false;" href="/sites/HBdesign/_layouts/userdisp.aspx?ID=20">User C</a></span>


Any help will be highly appreciated. 

Jul 12, 2012 at 8:27 PM

The markup you've pasted above is different than what the GetUserNames template is looking for. What type of column is it? Person or Group with multiselect enabled?


Jul 12, 2012 at 9:44 PM

Yes the column is of type Person or Group and multiselect is enabled as well. The Show field is selected to be "Name" and Show field seems to have bunch of options in dropdown, should it be something else to make it work?

Interestingly enough, even when i drop DVWP in a blank page, rather than giving the hyperlinks for People/Group field it's giving me all those HTML syntax.   

Jul 12, 2012 at 9:58 PM

Yup that was the trick, for some reason , in the properties of field I have assigned show field as 'Name' which is why it's spitting out wrong HTML which wasn't expected by GetUserNames. I have changed the show field to 'Name with presence' and it works now! 

As always thanks for looking into it Marc! 

Jul 13, 2012 at 1:27 AM

Sure thing. Glad you got it working.

These templates aren't foolproof; sometimes you may need to modify them.