Re: [xsl] Changing stylesheets though links

Subject: Re: [xsl] Changing stylesheets though links
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 31 Jan 2005 18:13:29 -0500
Daniel,

At 05:08 PM 1/31/2005, you wrote:
I'm looking for a method of changing stylesheets via links. The goal would be to allow users to resort the same data according to different keys (e.g. by choosing "resort date" "resort name" etc.). In each case, the same xml would load, only the stylesheet would change. If there is another method of doing this, I'm not wedded to this approach.
I figure this must be a faq, but a search of the archives shows only one abandoned thread on the topic from 1999 (unless I'm using the wrong terminology): <http://www.biglist.com/lists/xsl-list/archives/199908/msg00259.html> I also haven't seen anything at w3c or in the usual primers.


Any advice or where to look or how to do it?

If operating server-side is okay, The Sonneteer (http://sonneteer.xmlshoestring.com) demonstrates this kind of thing both in its directory sorting, and in the various layouts it provides the sonnets in the collection. (Actually the directory sorting is even fancier, since the directory itself is constructed on the fly from whatever is there, and then a stylesheet parameter sets the sort order and the templates used for the particular sort. It's also the only extensible library of poetry I've seen that sorts by rhyme scheme. :-) It's all configured by mapping URIs to call the engine with the stylesheet given different runtime parameters.


If operating on the client, you'll need scripting. You might check out Sarissa (http://sarissa.sf.net) to see what kind of support it provides for this kind of thing.

The bottom line is that XSLT itself doesn't provide any framework for event-driven parameterization: you have to rely on the framework technology. (The Sonneteer uses the 4Suite engine but Apache Cocoon is capable of the same, as are others.)

Another option that may be even better is to use Javascript to provide the re-sorting, on the next layer up from the XSLT. The html your stylesheet would generate would simply contain the code to achieve the sorting; these days sorting can be done with DOM scripting, so it should be fairly portable across current browsers.

Mail me off list if you need to know more, and I'll see what I can do.

Cheers,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

Current Thread