SharePoint - Content Query Web Part: Lookup Column Value and XSL

1.4k Views Asked by At

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 'Category' and

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

Returns a string with item's title (like 'Some Category'). But I need a URL or ID. Any suggestions?

2

There are 2 best solutions below

0
On

Try something like this :

<a>
    <xsl:attribute name="href">
        <xsl:value-of select="@Url" />
    </xsl:attribute>
    <xsl:value-of select="@Category" />
</a>
0
On

Use disable-output-escaping, for example:

{less than symbol}xsl:value-of disable-output-escaping="yes" select="@Category" /{greater than symbol}