views:

181

answers:

2

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?

A: 

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, ';#')" />
Rich Bennema
Thanks Rich, but that won't since @ColumnX only has the "title" even though is linked to another list. I was hoping to see if there was a way to obtain the title and the ID which one can then apply substring-before.
AlexanderN
So when you use <xsl:value-of select="@ColumnX"/>, you only get the title, no ID and no ';#'? Something is wrong. What is the type of ColumnX? Is it a Lookup field or just a Text field?
Rich Bennema
ColumnX is of type look up. It seems the DVWP filters the ID for you.
AlexanderN
A: 

I have same problem, and return '' because not return with format ID;#Content, it return Content only. Please help me. Send my email [email protected]

Hiepdh