Subject: [xsl] Random Sort From: "Tom Froehlich" <tom@xxxxxxxxxxx> Date: Wed, 20 Oct 2004 14:21:17 -0700 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] HTML sortable columns, Wendell Piez | Thread | Re: [xsl] Random Sort, Jeff Kenton |
Re: [xsl] Grouping Adjacent Element, Anton Triest | Date | Re: [xsl] union vs. "or" vs. contai, Robert Koberg |
Month |