[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Hello,
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="."/>
</xsl:for-each>
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.
- or -
Has anyone seen this done or have any ideas?
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
[xsl] Generic sort using multiple columns
Subject: [xsl] Generic sort using multiple columns From: Kyle Himmerick <kyle@xxxxxxxxxxxx> Date: Sun, 26 Oct 2003 22:48:27 -0700 |
Hello,
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="."/>
</xsl:for-each>
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: <LIST> <DATA> <firstName>Kyle</firstName> <phone>123.313.1234</phone> <job>grunt</job> </DATA> <DATA> <firstName>Joe</firstName> <phone>312.123.1234</phone> <job>boss</job> </DATA> </LIST>
maybe $asc = 'firstName, job' $desc = 'phone'
- or -
$orderby=firstName, phone, job $order=asc,desc,asc $type=text,number,text
Has anyone seen this done or have any ideas?
Thanks for your help. -Kyle
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Can I print well-formed X, Americo Albuquerque | Thread | RE: [xsl] Generic sort using multip, Michael Kay |
RE: [xsl] Can I print well-formed X, Americo Albuquerque | Date | RE: [xsl] Generic sort using multip, Michael Kay |
Month |
Keywords