473,399 Members | 3,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

dynamic sorting


I find that I can display structured data very nicely using XML with an
XSL template. As an extra 'goodie', I would like to give users the
ability to sort that data (for example with a button above a particular
column). What I need to know now is whether this is possible with
XML/XSL? Or do I need to resort to a programming language (maybe JScript?).

So far I have worked with the XML and XSL split into separate documents.
However, I would like to bundle everything into one file (so that it
can easily be moved or e-mailed) and was hoping that someone can tell me
if/how this can be done.

Any tips or pointers to HOWTOs or tutorials would be greatly appreciated.

Many thanks,
Alan Searle.

(PS: remove xxx if you want to e-mail me)
Nov 10 '05 #1
2 1864


Alan Searle wrote:
I find that I can display structured data very nicely using XML with an
XSL template.
It is likely a browser that displays the HTML document your XSLT
stylesheet creates as the result of a transformation. XSLT does not do
any "displaying".
As an extra 'goodie', I would like to give users the
ability to sort that data (for example with a button above a particular
column). What I need to know now is whether this is possible with
XML/XSL? Or do I need to resort to a programming language (maybe
JScript?).
XSLT 1.0 has the xsl:sort element you can use as a child of
xsl:apply-templates or xsl:for-each to first sort some node set and then
process it. So sorting is certainly possible in XSLT:
<http://www.w3.org/TR/xslt#sorting>

But as said, XSLT does not include "displaying" anything or showing
controls like a button, that is something a browser does when rendering
HTML documents.

If you want to have a button control in a HTML document displayed in a
browser trigger some sorting then you have the usual possibilities HTML
form controls offer, you can use a HTML form element with some action
URL on a server so that the browser sends a request to that URL on the
server and server-side you run an XSLT transformation with the sorting
and send the resulting HTML document back to the browser.

In browsers that support scripting and dynamic DOM manipulation you
could also consider doing the sorting client-side with JavaScript, but
that task is then usually independent of XSLT but simply an enhancement
of the HTML document which is the result of the XSLT transformation.

Finally a few browsers (Mozilla since 1.2, IE 6, or IE5/5.5 when MSXML 3
is installed) support client-side XSLT and expose an API to script to do
that, in these browser it might also be possible to perform the
transformation client-side and have a button call a script then runs a
transformation to then replace parts of the rendered document with the
sorted result of the transformation.
However, I would like to bundle everything into one file (so that it
can easily be moved or e-mailed) and was hoping that someone can tell me
if/how this can be done.


In theory a XML document can contain the XSLT stylesheet inline, see
<http://www.w3.org/TR/xslt#section-Embedding-Stylesheets> but not any
XSLT processor supports that.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 11 '05 #2
Hallo Martin,

Many thanks for your tips and URL links.

This will certainly get me moving.

Regards,
Alan Searle
Nov 11 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Michal Grabowski | last post by:
Hello, I need to have a stored procedure, which performs sorting. Something like this: CREATE PROCEDURE procname @sortby varchar(30) AS BEGIN SELECT some, columns FROM some_table
0
by: Karlo Swart via .NET 247 | last post by:
Hi. I am creating a dynamic datagrid. The columns are based on a request.querystring value. Eg: I will pass in a 'func=toys' parameter, which will cause the datagrid to load create columns...
12
by: CJM | last post by:
How can I dynamically sort the results from a Stored Procedure? Or more importantly, what is the fastest and most efficient way? I know I can do the sorting within the recordset in ASP, but AFAIK...
2
by: Shiju Poyilil | last post by:
I have a link button "lButton" created dynamically at the item databound event of the data grid "datagrid1" in the footer.so i want to execute the item command event of the datagrid on clicking...
10
by: jflash | last post by:
Hello all, I feel dumb having to ask this question in the first place, but I just can not figure it out. I am wanting to set my site up using dynamic urls (I'm assuming that's what they're...
2
by: rmturner76 | last post by:
I have a need to perform pagination while using dynamic sorting. As an exmaple - SELECT TOP(10) * FROM ( SELECT TextColumn, DecimalColumn, ROW_NUMER() OVER ( ORDER BY CASE @x
1
by: Pacific Fox | last post by:
Hi all, I have a SQL statement that allows paging and dynamic sorting of the columns, but what I can't figure out without making the SQL a dynamic string and executing it, or duplicating the SQL...
1
by: =?Utf-8?B?cGVsZWdrMQ==?= | last post by:
i have a GridView which i can Page on (go to page 2,10,...) the thing is that i have a dynamic query which set the GridView from starts on page 1. the thing is that when i start to go over the...
3
Frinavale
by: Frinavale | last post by:
I have implemented the ITemplate interface to dynamically "display" complicated data in a GridView. For the life of me I cannot implement the template in such a way that when it is applied to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.