This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: To what extent can sorting be done?
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] To what extent can sorting be done?
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Sun, 18 Feb 2001 09:16:26 -0000
- Reply-To: xsl-list at lists dot mulberrytech dot com
This is a common requirement and it can usually be met by writing
<xsl:sort select="*[name()=$p]"/>
where $p is a parameter.
In more elaborate cases it requires the evaluate() function, which
constructs an XPath expression as a string: this is now available in a
number of processors including Saxon, Xalan, 4XSLT, and probably others.
Mike Kay
> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of
> Kevin Duffey
> Sent: 18 February 2001 07:04
> To: xsl-list@lists.mulberrytech.com
> Subject: [xsl] To what extent can sorting be done?
>
>
> Hi there,
>
> I have read very little about this so I apologize if it is a stupid
> question. If I do a server-side query and get say 100 rows
> back, each row
> having 10 columns. Normally, to sort by a column (assuming
> the rows were
> displayed on a web page) I would click on that column, go to
> the server, do
> some java code the reorders the list based on the selected
> column, then
> redisplays the rows, based on the sorted column. So the
> question is, do I
> have to write code for each column I want sorted, or does XSL
> allow this
> itself? I haven't touched on sorting yet in XSL, but someone
> told me that
> supposedly I can get XSL to take the same XML input and sort
> it by various
> columns (assuming lets say a 2D table of rows/columns). Would I need a
> different XSL for each column, or can I just use some
> <xsl:choose..> tags
> to sort the data in a particular column and still use the one XSL. Any
> examples (that don't require lots of your time) would be
> great either in
> XSL, or how it is possible.
>
> In the meantime, I will be reading up in my XSL book from Mr. Kay.
>
> Thanks.
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list