SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There is a List with Lookup field. And there is a CQWP web part which uses this list as a Source and uses custom XSL style added to Itemstyle.xsl. And there is a problem how to render this field as a link?

Field name is Vegetable and

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

Returns a string with item's title (like 'Potato'). Any suggestions?

UPDATE I've found an article with similar problem. And here is a comment form it:

We raised a call with Microsoft PSS in the end and we’ve been told today by PSS after consulting with the SharePoint dev team that this is a known issue and that Custom Fields using the People or Groups field type do NOT work with the CQWP, only out of the box fields.

The workaround above does work, however further tests show it’s not reliable and is very situational.

share|improve this question
You shouldn't put the answer inside the question. You should put your answer in the answer field, mark it, so it'll be closed – XristosK Sep 14 '14 at 15:53

Have you tried like this?

<a href="/Lists/lookuplist/dispform.aspx?id={substring-before(@Vegetable,';#')}" ><xsl:value-of select="substring-after(@Vegetable,'#')" /></a>
share|improve this answer
For some reason the value of attribute Vegetable is like 'Potato' but it should be like 'Potato;1'. – Serhiy Sep 6 '12 at 2:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.