Saturday, March 12, 2011

Get Current Site Name in Item Style in SharePoint

If you want to get current site Name in item style you can use this field "FileRef" which return the complete url of page like this (/Faq/Pages/faq1.aspx) so to get only the (Faq) site Name you can do the following:

<xsl:value-of select="substring-before(substring-after(@FileRef, '/'),'/')" ></xsl:value-of>

to see all fields and its value in item style use the following:
 <xsl:for-each select="@*">               
         <xsl:value-of select="name()" /> <xsl:value-of select="."/> <br/>                    
 </xsl:for-each>

Ref:
Content Query Web Part Display all fields + values
http://vspug.com/rohan/2008/08/12/content-query-web-part-display-all-fields-values/

No comments: