Wednesday 14 May 2008

XSLT in the browser

XSLT in the browser, its original motivating use case, has had a somewhat difficult time, but with support finally appearing in Opera and Safari, and the support in IE and Firefox/mozilla being fairly stable it looked like perhaps its time had come (even if stuck in an XSLT 1 era).

But then came Firefox 3 beta 5.....

Firefox has decided that relative links that traverse the filesystem out of the current directory are a security error. They are (pretty confusingly) reported as XML parse error rather than a security error.

https://bugzilla.mozilla.org/show_bug.cgi?id=427333

This is pretty fatal to browsing XML files on the filesystem, at NAG for instance, the documentation is distributed as a directory tree of a few thousand XML files, at the top level is a styles directory and so the individual files have xml-stylesheet links linking to ../../styles/foo.xsl or whatever is needed. This works in all browsers that support XSLT at all, except firefox 3 beta 5. Where apparently the only solution is to change the link to href="foo.xsl" and then copy the stylesheet into dozens of directories. Blurgh....

I hope bug 427333 gets fixed before FF3 gets out of beta....

Update: ../ stylesheets work again in FF3 release candidate 1, yipee!

1 comment:

Anonymous said...

It appears, however, that if you include an html link tag that references (with a relative address) a css in your xslt that you still have problems if it goes outside the Firefox security sphere of your xml/xslt files. Example: (link tag) rel=”stylesheet” type=”text/css” media=”screen” href=”../../xxxx/yyyy/zzz.css”/(end link tag). I am using Firefox 3.0 (not beta).

Also in certain cases (not all), for reasons I cannot define yet, with relative addresses to .xml files that are outside of the highest directory in the Firefox security sphere, I am still not able to access relative addresses in Firefox 3.0 (not beta) from xml/xslt files.