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

Re: Generic sort using multiple columns

Subject: Re: Generic sort using multiple columns
From: Kyle Himmerick <kyle@xxxxxxxxxxxx>
Date: Mon, 27 Oct 2003 09:10:52 -0700
xsl sort multiple fields
Thanks for the suggestion Michael.

By generating a stylesheet for the chosen sort order I am assuming you mean generating it on the fly?

I'm not sure how to accomplish this.

FYI - I will be running all transformations on the server side with Xalan.

Michael Kay wrote:

I think that when it gets to this level of complexity, you should
seriously consider generating a stylesheet containing xsl:sort elements
to reflect the chosen sort order. If you're running client side, the
extra processing cost probably won't be noticeable.

Michael Kay

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Kyle Himmerick
Sent: 27 October 2003 05:48
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject: Generic sort using multiple columns

I need to allow users to sort data by multiple columns (primary, secondary, tertiary etc).

I'm trying to keep it as generic as possible. For example, the user might choose to sort by column 1 asc, column 2 desc and column 3 asc. I'll handle this as a list control where they can change the sort order on each column (ie 1st click sorts column asc, 2nd click sorts column desc, 3rd click removes sort without affecting any other columns that may be sorted). So precedence will be in the order the elements appear (or left to right when displayed).

I am already doing a dynamic sort using:

<xsl:for-each select="DATA">
<xsl:sort select="*[name()=$orderby]" order="{$order}" data-type="{$ordertype}"/>
<xsl:apply-templates select="."/>

My web page is passing in these three variables orderby, order and ordertype. This works well but does not meet my above requirement.

I can fight with constructing parameters to be passed into the stylesheet, but I'm stuck as to how I can actually apply them.

sample xml format:

$asc = 'firstName, job'
$desc = 'phone'

- or -

$orderby=firstName, phone, job

Has anyone seen this done or have any ideas?

Thanks for your help.

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list

Current Thread


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.
First Name
Last Name
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.