Send querystring to Xslt

07/12/2012 15:25

1. Define querystring in .webpart file
<property name="ParameterBindings" type="string">&lt;ParameterBinding Location="QueryString(category)" Name="CategoryString"/&gt;</property>

 

or equivalent in .aspx file

<ParameterBindings>

<ParameterBinding Name="CategoryString" Location="QueryString(category)"/>

</ParameterBindings>

 

2. Add parameter to ContentQueryMain.xsl
<xsl:param name="CategoryString"/>

 

3. Use it in ContentQueryMain.xsl

From query string: <xsl:value-of select="$CategoryString"/>

 

so if you use link: http://server/sitecollection/default.aspx?category=dogs, $CategoryString=dogs is sent to xslt.