[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Random Sort

Subject: Random Sort
From: "Tom Froehlich" <tom@xxxxxxxxxxx>
Date: Wed, 20 Oct 2004 14:21:17 -0700
xsl random
I maintain a Web directory of fundraising software hosted on IIS
(www.tfraise.com/listings.aspx) and cannot figure how to get my listings to
be rendered unsorted or, more to the point, sorted in a random manner each
time the page is requested. I do not want to give vendors/software with
names starting with the latter A a constant top ranking because of
alphabetical sorting, but give every vendor/software an equal chance at
first user request. Is this really complicated to do? I had a hard time
getting it to work as well as it is now.

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="C:\.....\tblSystems.xsl"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="html" version="4.0"/>
	<xsl:param name="querykey1">sFunction</xsl:param>
	<xsl:param name="queryvalue1">Fundraising</xsl:param>
	<xsl:param name="sortkey1">sName</xsl:param>
	<xsl:param name="datatype">text</xsl:param>
	<xsl:param name="order">ascending</xsl:param>
	<xsl:template match="/">
		<table border="0" cellpadding="4" cellspacing="0"
width="573" align="left" style="border-collapse: collapse">
			<tr>
				<td width="29">
					<img border="0"
src="images/rightarrow.gif"/>
				</td>
				<td valign="top" colspan="2">
					<h2>Free Listing of  <xsl:value-of
select="count(//tblSystems[*[name()=$querykey1]=$queryvalue1])"/>
						<xsl:text>  </xsl:text>
						<xsl:value-of
select="$queryvalue1"/> Systems.</h2>
				</td>
			</tr>
			<xsl:for-each
select="//tblSystems[*[name()=$querykey1]=$queryvalue1]">
				<xsl:sort data-type="{$datatype}"
select="*[name() = $sortkey1]" order="{$order}"/>
				<tr>
					<td/>
					<td valign="top" width="272"
bgcolor="#F4F9FF">
						<hr/>
						<xsl:number/>
						<xsl:text>. </xsl:text>
						<b>
							<xsl:value-of
select="sName"/>
						</b>
						<br/>
						<i>
							<xsl:value-of
select="Name"/>
						</i>
						<br/>



*************************
Tom Froehlich, CFRE
www.tfraise.com

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.