Re: [xsl] XSL support detection

Subject: Re: [xsl] XSL support detection
From: "Wesley W. Terpstra" <wesley@xxxxxxxxxxx>
Date: Sun, 18 Aug 2002 14:37:42 +0200
On Sun, Aug 18, 2002 at 12:20:59PM +0100, James Fuller wrote:
> > My application supports server-side xslt or client-side.
> > The browser can access .html or .xml.
> >
> > However, I would like the front-page to somehow check for xslt
> > and redirect
> > the browser to the right location.
> 
> you will need to find an external solution to this problem, in other words
> use one of the many fine javascript browser sniffers that are out
> there.....this is really not the forum for javascript questions...ah heck
> its a sunday.

Indeed; I know I could do this, but it is a last resort. I don't want to
have to keep track of 20 browsers and the current state of their xslt
support. I would much rather check directly.

> > However, after much banging of my head against the wall, I
> > finally realized
> > that it doesn't matter a damn what content-type the webserver says it is,
> > IE6 _will not_ apply xslt unless the file is called *.xml!
> 
> hmmmm, this is because your server httpd.conf file ( e.g. in apache ) is set
> to apply the correct mime type to files that have .xml ending....there is
> nothing stopping you adjusting this...well you will need server access.

No, this is not apache's fault; I changed the types with AddType, and
checked the output headers directly by connecting. It really is IE6's fault;
it does not respect the Content-Type the server reports.

> <script language="JavaScript">
> <![CDATA[
> function redirect(){
> if(is_mac==true ){document.location.href='main_ie.xml';}
> else if(is_ie4up==true){document.location.href='main_ie.xml';}
> else if(is_ie4==true){document.location.href='main_ie.xml';}
> else if(is_aol5==true){document.location.href='main_ie.xml';}
> else if(is_nav6up==true){document.location.href='main_nn.xml';}
> else if(is_gecko==true){document.location.href='main_nn.xml';}
> else if(is_nav4==true){document.location.href='main_nn.xml';}
> }
> ]]>
> </script>
>
> [snip huge attached javascript routine]

Thanks for the code; I will definitely use it if there is no other solution!

However, this is exactly what I want to avoid. It is too complex and
requires that I personally keep track of things. 

I would rather check for xslt by doing something that would use xslt if it
were present---either by trying to use a stylesheet as above, or just asking
javascript directly. Like a if (browser.xslt.version >= 1) or something.

-- 
Wesley W. Terpstra <wesley@xxxxxxxxxxx>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread