Geeks With Blogs

About Me:
I am a Female SharePoint Developer (a platinum unicorn). I have been working with SharePoint since I attended the Portal University in 2005. I hold a BA in Computer Science from the University of Missouri - Kansas City. I love playing Rockband, organizing user group meetings, working with code, attending events as a speaker or organizer, and having bizarre conversations about geek things with cool people. If you have any comments or questions fill out the contact form and I will try my best to help.

The Guide of a MOSSLover Becky Isserman's Blog
So I was building a standard dataview in SharePoint 2010.  I had the $thisNode information, but I couldn't figure out why my $thisNode/@Priority was not working for my Priority field.  I realized it was a lookup field.  Thanks to Marc Anderson I could do a print statement and figure out how to parse out the Priority from after the #.  Here is a nice snippet to get information for a Lookup in a condition in XSLT:

<xsl:param name="thisPriority" select="substring-after($thisNode/@Priority.,'#')"/>
First you want to put your parsed out data into a parameter

<xsl:if test="$thisPriority = 'High'" ddwrt:cf_explicit="1"><img alt="{$thisPriority}" src="/_layouts/images/kpidefault-2.gif" /></xsl:if>
<xsl:if test="$thisPriority = 'Medium'" ddwrt:cf_explicit="1"><img alt="{$thisPriority}" src="/_layouts/images/kpidefault-1.gif" /></xsl:if>
<xsl:if test="$thisPriority = 'Low'" ddwrt:cf_explicit="1"><img alt="{$thisPriority}" src="/_layouts/images/kpidefault-0.gif" /></xsl:if>

Next you can put the parameter data into a condition to determine based on high, medium, or low priority the proper picture to show. 

Hopefully, this post helps save countless hours for someone else parsing out conditions in XSLT using a lookup field.  Enjoy!

Posted on Thursday, February 13, 2014 11:38 AM | Back to top

Comments on this post: Re-Visiting KPIs using a Lookup Field & XSLT in SharePoint 2010

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © MOSSLover | Powered by: