Paul's profilePaul Galvin's SharePoint...BlogListsSkyDrive Tools Help

Blog


    December 21

    Quick Tip: Content Query Web Part, Lookup Column Value and XSL

    I have a column name in a content type named "Real Estate Location".

    That column is of type "lookup".

    I have modified <CommonViewFields> and ItemStyle.xsl to show the column.

    A simple <xsl:value-of select=...> returns back an internal value that includes ordinal position data, such as:

    1;#Miami

    To get the human-friendly value, use xsl substring-after, as shown:

    <xsl:value-of select="substring-after(@Real_x005F_x0020_Estate_x005F_x0020_Location,'#')"></xsl:value-of>

    Use this technique whenever you are working with lookup values in XSL transforms and need to get the human-friendly value.

    <end/>

    Technorati Tags: , ,

    Comments (2)

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    No namewrote:
    Hi,
     
    Any advice on why I cannot get my lookup columns to display on the Content Query Web Part? Did you have to do anything special in your  <CommonViewFields> for lookups?
     
    TIA,
    Dave
    May 30
    Chriswrote:
    Paul,
     
    Thank you so much for this great tip! I will be using this in a up-and-coming project, and you have helped me get off on a good foot already!
     
    Thanks again! (And I didn't get you anything for Christmas!)
     
    Chris
    Dec. 27

    Trackbacks

    The trackback URL for this entry is:
    http://paulgalvin.spaces.live.com/blog/cns!1CC1EDB3DAA9B8AA!544.trak
    Weblogs that reference this entry
    • None