views:

21

answers:

2

Is there a way to switch a CSS stylesheet using XSLT? We are trying to do this without Javascript or include different files based on what CSS Stylesheet is used.

Example:

XSLT for normal view. Click a link and switches the stylesheet to view a Text Only view for accessibility and screen readers to use. At the same time getting rid of all the Javascript references in the Head of the HTML. Also need to use a switch to determine mobile devices and then use the correct CSS stylesheet and Javascript files for the mobile version.

Can anyone point us in a direction? Thanks in advance.

A: 

That's a weird way to word it, but it sounds like you just want to have different XML files that are linked to different XSL stylesheets:

Then just have them link to one another. You can easily do this by hand or by writing a server-side script that serves them up based on a passed parameter:

How the latter is implemented depends on your server-side programming language but should be very straightforward.

Lèse majesté
A: 

For one only XSLT stylesheet, you have two options:

  1. Passing metadata inside document retrived by links URI
  2. Cacth click event and pass parameter to stylesheet with javascript.

About CSS: you could also use media query (taking care about crossbrowser issues), or you could check user agent string server side.

Alejandro