Wednesday, November 5, 2014

Basic item style for CQWP

CQWP uses ItemStyle.xsl file which is located in the site collection's Style Library. By editing the ItemStyle.xsl file, we can add a custom item style, which can be selected from CQWP to show all the Vendors List fields with headings.



  1. Open the site collection URL
  2. Replace the /SitePages/Home.aspx with /Style%20Library/Forms/AllItems.aspx to open the Styles Library.
  3. Now it will show the following list of folders. Open the XSL Style Sheets folder to view the Itemstyle.xsl file.  
  4. Download the ItemStyle.xsl file to your computer
  5. Open it in a notepad and Scroll down to the bottom of the file. Now Copy the following code block and paste it above the closing xsl:stylesheet tag. Here the first HTML Table row represents the column headings and the second HTML table row represents the actual data.






<xsl:template name="CustomStyle" match="Row[@Style='CustomStyle']" mode="itemstyle">
    <html>
    <table width="100%">
   
    <tr>
        <td width="8%" valign="top"><div class="item"><xsl:value-of select="@Title" /></div></td>
     
    </tr>
    </table>
    </html>
  </xsl:template>

No comments:

Post a Comment