First published on TECHNET on Jul 24, 2012
This post is a contribution from Charls Tom Jacob, an engineer with the SharePoint Developer Support team.
Content Query Web Part is a nice way to query and display data from multiple lists. By default, when you click on a link displayed in the Content Query Web Part, it opens up in the same IE browser window. This can be annoying at times if users want to stay on the main page and view the items in a different IE browser window.
In this post, I’ll describe how to extend the out of the box Content Query Web Part and the styles such that links open in new IE window.
Step1: Extend out of the box XSL
<div class=”link-item”>
<a href="{$SafeLinkUrl}" title="{@LinkToolTip}">
As
<a href="{$SafeLinkUrl}" title="{@LinkToolTip}" target="_blank">
<!--<xsl:if test="$ItemsHaveStreams = 'True'">
<xsl:attribute name="onclick">
<xsl:value-of select="@OnClickForWebRendering"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$ItemsHaveStreams != 'True' and @OpenInNewWindow = 'True'">
<xsl:attribute name="onclick">
<xsl:value-of disable-output-escaping="yes" select="$OnClickTargetAttribute"/>
</xsl:attribute>
</xsl:if>-->
Step2: Extending the Content Query Web Part
a. Set the title property to "Extended Content Query"
<property name="Title" type="string">Extended Content Query</property>
b. Set the XSLItemLink to the uploaded XSL style sheet file:
<property name="ItemXslLink" type="string">/Style%20Library/XSL%20Style%20Sheets/ItemStyleExtended.xsl</property>
Hope this helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.