Can the ID from a referenced column be obtained when using SharePoint's Data View Part?

1.5k views Asked by At

I have a Data View Part pulling from a list that has a lookup column to another list (title linked by ID)

And somewhere in the XSLT of the data view web part configuration, it reads

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

Now since ColumnX is a reference to another list (linked to item), how do I go about obtaining the ID rather than the text? Is there a ddwrt trick out there?

1

There are 1 answers

3
Rich Bennema On

The value of a Lookup Field is in the format of "ID;#Text". To get the ID value, we use is regular xslt:

<xsl:value-of select="substring-before(@ColumnX, ';#')" />