How to sort in content in lists

Topics: XSLT
Oct 20, 2010 at 9:33 PM

I have a large newsarea on my site - with a newslist. Does anyone have some experience with how to make a dropdown filter that can help the users to sort the news by month (or other categories)

Oct 20, 2010 at 10:26 PM

Peter,
Basic idea have drop down inside the form.. and have onchange event submit the form:

<form>
	<input type="submit" name="submit" id="submit" value="Submit Me" />
	<select name="filter" id="filter" onchange="this.form.submit();">
		<option>Value 1</option>
		<option>Value 2</option>
		<option>Value 3</option>
	</select>
</form>


than.. inside the XSLT function.. you read filter value with build-in C1 function:

		<xsl:variable name="filter" select="c1:GetFormData('filter')" />

(please make sure you have xmlns:c1="http://c1.composite.net/StandardFunctions" at the top)... than you just check filter value and change xslt accordingly.. something like this:

<xsl:for-each select="/in:inputs/in:result[@name='GetCommentsXml']/Comments">
	<xsl:if test="$filter='1'">
		<xsl:sort select="@Date" />
	</xsl:if>

Hope it's helps.. otherwise post more details :)


<select name=select1 onchange='OnChange(this.form.select1);'>