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

Re: HTML sortable columns

Subject: Re: HTML sortable columns
From: John <john-xsl-list@xxxxxxxx>
Date: Thu, 21 Oct 2004 07:28:49 -0700
sortable columns in html
Thanks. The developer is currently planning to generate multiple HTML files with pre-sorted, which seems a little silly to me. I was hoping to suggest XML/XSL as an alternative, as I would really expect it to be possible with these tools. For instance, assuming the following simplified XML:

<table>
 <row>
     <column sortid="1">value</column>
     <column sortid="2">value</column>
 </row>
 <row>
     <column sortid="1">value</column>
     <column sortid="2">value</column>
 </row>
</table>

If the application server passes a valid sortid value, shouldn't it be possible to have multiple sorts in the XSL, or sort using the parameter as criteria? What I type below is just "pseudo code" as this really isn't my problem and I don't have time to test. Sorry for my for-each but I'm not yet good with apply-templates.

<xsl:param name="sortid" select="'1'" />

<xsl:for-each select="/table/row/column[@sortid=$sortid"]>
 <xsl:sort select="text()" />
 <xsl:call-template name="row" />
</xsl:for-each>

The row template would need to know about the column's siblings. Seems possible, what am I missing?

Thanks again,

-John

Jarno.Elovirta@xxxxxxxxx wrote:

Hi,



I'm actually asking this question "for a friend".

In the generic context of some application/webserver, does anyone have any XSL suggestions or examples for presenting a table (generated from XML data) with headers that let the users sort the data by different columns?



The solution is partially out of scope for XSLT. Your friend can implement sorting by retransforming the source and passing the sort key name as a parameter, but they need to write non-XSLT code to handle the retransform requests, be it e.g. Java at server-side and ECMAScript at browser-side.


Cheers,

Jarno - VNV Nation: Honour (Juno version)

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.