Home > Content Query, Field, SharePoint, XSL, XSL > CQWP (Content Query Web Part) Display all fields + values

CQWP (Content Query Web Part) Display all fields + values

Moved from old blogging site

Below is the code which I use frequently for my XSL development in CQWP. This xsl code gets all the data and values, this helps you identify all the data before you move on with visual html development. Initially I used this custom xslt to display all the field names in Content Query Web part. I modified it to see values along with field name. Its simple needs no explanation.


<xsl:template name="AllFields" match="Row[@Style='AllFields']" mode="itemstyle">
 <xsl:param name="CurPos"/>
 <xsl:variable name="SafeLinkUrl">
 <xsl:call-template name="OuterTemplate.GetSafeLink">
 <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
 </xsl:call-template>
 </xsl:variable>
 <xsl:variable name="SafeImageUrl">
 <xsl:call-template name="OuterTemplate.GetSafeStaticUrl">
 <xsl:with-param name="UrlColumnName" select="'ImageUrl'"/>
 </xsl:call-template>
 </xsl:variable>
 <xsl:variable name="DisplayTitle">
 <xsl:call-template name="OuterTemplate.GetTitle">
 <xsl:with-param name="Title" select="@Title"/>
 <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
 </xsl:call-template>
 </xsl:variable>
 <xsl:variable name="LinkTarget">
 <xsl:if test="@OpenInNewWindow = 'True'" >_blank</xsl:if>
 </xsl:variable>
 <div id="linkitem" class="item">
 <xsl:for-each select="@*">
 <span style ="font:bold">    <xsl:value-of select="name()" /> </span>  : <xsl:value-of select="."/> <br/>
 </xsl:for-each>
 </div>
 </xsl:template>

<p>&nbsp;</p>

——————————————

Advertisements
Categories: Content Query, Field, SharePoint, XSL, XSL Tags: ,
  1. December 14, 2010 at 3:08 am

    Handy.

    I made a slight change to make it easier to read:

  2. December 14, 2010 at 3:09 am

    doesn’t want to let me paste my changes 😛

    I basically just wrapped it in a table.

    Much easier to read that way.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: