แฟ้มประวัติPaul Galvin's SharePoint...บล็อกรายการSkyDrive เครื่องมือ วิธีใช้
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: , ,

ข้อคิดเห็น (3)

โปรดรอสักครู่...
ขออภัย ข้อคิดเห็นที่คุณป้อนยาวเกินไป โปรดย่อให้สั้นลง
คุณไม่ได้ป้อนข้อมูลใดๆ โปรดลองอีกครั้ง
ขออภัย เราไม่สามารถเพิ่มข้อคิดเห็นของคุณได้ในขณะนี้ โปรดลองอีกครั้งในภายหลัง
ในการเพิ่มข้อคิดเห็น คุณต้องได้รับการอนุญาตจากผู้ปกครองของคุณ ร้องขอการอนุญาต
ผู้ปกครองของคุณได้ปิดการแสดงข้อคิดเห็น
ขออภัย เราไม่สามารถลบข้อคิดเห็นของคุณได้ในขณะนี้ โปรดลองอีกครั้งในภายหลัง
คุณแสดงข้อคิดเห็นเกินขีดจำกัดสูงสุดที่สามารถทำได้ในหนึ่งวันแล้ว โปรดลองอีกครั้งในอีก 24 ชั่วโมง
บัญชีของคุณถูกปิดใช้งานการแสดงข้อคิดเห็น เนื่องจากระบบของเราพบว่าคุณอาจกำลังสแปมผู้ใช้รายอื่น หากคุณมั่นใจว่าบัญชีของคุณถูกปิดใช้งานอย่างไม่ถูกต้อง โปรดติดต่อ ฝ่ายสนับสนุน Windows Live
ดำเนินการตรวจสอบความปลอดภัยทางด้านล่างเพื่อให้การแสดงข้อคิดเห็นของคุณเสร็จสมบูรณ์
อักขระที่คุณป้อนในการตรวจสอบความปลอดภัยต้องตรงกับอักขระในรูปภาพหรือเสียง
Paul Galvin ปิดข้อคิดเห็นในเพจนี้
Vivianเขียน:
Hi Paul,

It looks like what you are describing here is the solution to what I need, but am unfortunately a newbie in XSL and can't figure it out from your post above.

Let me quickly explain what I am trying to do and what I need and would greatly appreciate your help :)

I am creating product pages in a document library and in this library I am associating values through columns to each page, e.g. Page name: Product A and in that row a column "Market applicability". The values that are available for "market applicability" are in a custom list in a separate library and are imported via a look-up and then defined that various options are possible (in that column).

Now let's say product A is available in the US & Canada and we select those in the column attributes to the page. I would like to have US & Canada then appear on the page itself and I think what you are discussing above is the answer to my question - now the big Q is exactly how do I implement it?

My company does not allow me to work with sharepoint designer and we do not have the DFWP web part available :s so I have been doing the majority of my alterations with code in CEWP (I also have a XML/XSL web part available if that helps).

The only solution that my web management team has given me is to create an alternative view of the product page document library for that product and include that view in my page - however given that we have over 200 products and I have this issue with 4 columns (market applicability, target audience, etc.) I do not want to spend my time creating 1,000 views.

My site structure is as follows:
Product A page: https://domain.com/sites/mysitename/productpages/ProductA.aspx
Product page document library: https://domain.com/sites/mysitename/productpages/Forms/AllItems.aspx
Original list with values: https://domain.com/sites/mysitename/Lists/Market%20applicability/AllItems.aspx

Could you please advise me what code I need to use in order to include the market applicability values of "US & Canada" (in this case) in my product page?

Thanks so much for your help!

Vivian
9 ส.ค.
ไม่มีชื่อเขียน:
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
30 พ.ค.
Chrisเขียน:
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
27 ธ.ค.

การติดตามข้อมูล

URL การติดตามข้อมูลสำหรับข้อมูลนี้คือ:
http://paulgalvin.spaces.live.com/blog/cns!1CC1EDB3DAA9B8AA!544.trak
เว็บล็อกที่อ้างอิงข้อมูลนี้
  • ไม่มี