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?

Alex Nolasco
  • 18,750
  • 9
  • 86
  • 81

1 Answers1

0

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
  • 10,295
  • 4
  • 37
  • 58
  • 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. – Alex Nolasco Apr 03 '10 at 17:03
  • So when you use , 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 Apr 07 '10 at 13:29
  • ColumnX is of type look up. It seems the DVWP filters the ID for you. – Alex Nolasco Apr 28 '10 at 21:50