[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Changing stylesheets though links

Subject: RE: [xsl] Changing stylesheets though links
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 31 Jan 2005 23:55:37 -0000

I'm not sure what you mean by "links" - you mean the user clicking on

Personally my preferred method of doing this is to have a fixed stylesheet,
but with dynamically-evaluated XPath expressions representing the sort keys
- you can pass these expressions into the stylesheet as parameters, or store
them in a source document acting as a configuration file; it's very
flexible. It means using an extension such as saxon:evaluate or EXSLT's
dyn:evaluate, but in my view it's a much cleaner design than modifying the
stylesheet as a whole - that approach strikes me as a maintenance nightmare
unless you design it very carefully.

The details do depend rather on whether you want to do it client side or
server side.

There's a detailed example of how to do it (client side, modifying the
stylesheet each time) in the MSXML3 appendix of the 2nd edition of my XSLT
Programmer's Reference - it didn't get carried through to the 3rd edition
which is all about XSLT 2.0.

Michael Kay

> -----Original Message-----
> From: Daniel O'Donnell [mailto:daniel.odonnell@xxxxxxxx] 
> Sent: 31 January 2005 22:08
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Changing stylesheets though links
> Hi all,
> 	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/msg0025
> 9.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?
> -dan
> -- 
> Daniel Paul O'Donnell, PhD
> Associate Professor of English
> University of Lethbridge
> Lethbridge AB T1K 3M4
> Tel. (403) 329-2377
> Fax. (403) 382-7191
> E-mail <daniel.odonnell@xxxxxxxx>
> Home Page <http://people.uleth.ca/~daniel.odonnell/>
> The Digital Medievalist Project: <http://www.digitalmedievalist.org/>

Current Thread