Remote References to XSL in Firefox

Album Cover: Into the Wild

"I knew all the rules, but the rules did not know me...guaranteed."
Eddie Vedder / Guaranteed

Posted on April 11, 2006 9:34 PM in XML
Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.

After putting together an XSL stylesheet today to transform some XML files I was working with, I added a reference to one of the files, like so:

<?xml-stylesheet type="text/xsl" href="http://example.com/xsl/style.xsl"?>

While I was writing the stylesheet, I used a local, relative reference to the file, but when I was finished I wanted to host the file in a central location so that anyone could add a reference like the one above to their XML files to take advantage of it. A quick glance at the transformed file in Internet Explorer showed no problems. A quick glance in Firefox, though, was a different story.

When all I saw was bare text and no styling at all, my first hunch was that Firefox doesn't allow absolute references to stylesheets so that any security issues with remote files can be avoided. The only reason this was my first hunch was because of the number of run-ins I've had with Firefox and these types of security measures in other areas. A forum thread over at thescripts.com confirmed my hunch.

So if you want to apply an XSL transformation to an XML file and have it work in Firefox, be sure to only use local references. If the XML file is hosted somewhere, store the transformation on the same server. If you're dealing with local XML files that see their fair share of travel, make sure they always carry your transformation with them.

Comments

Joachim A. on January 26, 2009 at 3:26 PM:

Thank you for the info. I recognized the same. So there's no alternative to distributing the xsl-file with the content, is it?
Joachim

Permalink

Post Comments

If you feel like commenting on the above item, use the form below. Your email address will be used for personal contact reasons only, and will not be shown on this website.

Name:

Email Address:

Website:

Comments:

Check this box if you hate spam.