Thursday, October 11, 2007

CQWP debug item style

Reading this post a few months ago I found this great tip. If you want to know what are the fields that your CQWP receives you can use this item style to "debug" it.

<xsl:template name="Debug" match="Row[@Style='Debug']" mode="itemstyle">
<xsl:for-each select="@*">
                <xsl:value-of select="name()" />

It will show all the fields passed to the web part (internal names). I recommend you to read the entire article; it shows the basis about the customization of the CQWP.

Related links:


Anonymous said...


is there a possibility also to show the content of the returned fields?

greetz, Kristof

Àlex said...

In order to get the value of a passed field to a CQWP you can use the following XSLT templete:

<xsl:template name="test" match="Row[@Style='test']" mode="itemstyle">
<xsl:value-of select="@fieldname" disable-output-escaping="yes"/>

The attribute disable-output-escaping allows to show the "HTML value". By default it is set to "No".

I tried to make a template to get a list with all fields and the associated values but it did not work because I was unable to get the value for each item.

Kozar said...

if you want to view the value of the current row simply select="."

eg <xsl:value-of select="." disable-output-escaping="yes"/>

R. Kozar

Online Visitors