Firefox 3 - XLST - Fails if local with .. in path [FIXED]

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
Post Reply
tripecac
Posts: 5
Joined: August 1st, 2006, 11:25 am

Firefox 3 - XLST - Fails if local with .. in path [FIXED]

Post by tripecac »

Firefox 3 fails to process XSLT files if they are outside of the current XML file's path (or descendant paths).

For example, these work:

<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<?xml-stylesheet type="text/xsl" href="sub/test.xsl"?>

But these fail:

<?xml-stylesheet type="text/xsl" href="../test.xsl"?>
<?xml-stylesheet type="text/xsl" href="../sub/test.xsl"?>

This seems to only be for local files (not handled by a web server). I can reproduce it in both Ubuntu and Vista.

Firefox 2 and IE7 don't have this problem.

Any idea how to fix it?

Thanks!

Travis
Last edited by tripecac on June 17th, 2008, 5:40 pm, edited 2 times in total.
tripecac
Posts: 5
Joined: August 1st, 2006, 11:25 am

Re: Firefox 3 - XLST - Fails if local stylesheet has .. in path

Post by tripecac »

Here are my simplified test files:

test/xsl/test.xsl

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/test"><html><body><h1>This worked: <xsl:apply-templates /></h1></body></html></xsl:template>
</xsl:stylesheet>

test/xsl/test.xml (xsl in same path, works)

Code: Select all

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<test>xsl in same path</test>

test/test.xml (xsl in child path, works)

Code: Select all

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="xsl/test.xsl"?>
<test>xsl in child path</test>

test/xsl/sub/test.xml (xsl in parent path, FAILS)

Code: Select all

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="../test.xsl"?>
<test>xsl in parent path</test>

test/xml/test.xml (xsl in sibling path, FAILS)

Code: Select all

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="../xsl/test.xsl"?>
<test>xsl in sibling path</test>
User avatar
Daifne
Moderator
Posts: 123071
Joined: July 31st, 2005, 9:17 pm
Location: Where the Waters Meet, Wisconsin

Re: Firefox 3 - XLST - Fails if local stylesheet has .. in path

Post by Daifne »

Moving to Web Development
User avatar
jscher2000
Posts: 11771
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA
Contact:

Re: Firefox 3 - XLST - Fails if local stylesheet has .. in path

Post by jscher2000 »

I don't have Firefox 3. Is the problem limited to relative ../ paths? How about an absolute sibling path, such as "/styles/text.xsl"?
tripecac
Posts: 5
Joined: August 1st, 2006, 11:25 am

Re: Firefox 3 - XLST - Fails if local stylesheet has .. in path

Post by tripecac »

Good question!

This works: file:///X:/temp/xslt-test/xsl/test.xsl
but this doesn't: /temp/xslt-test/xsl/test.xsl

(at least in Vista)
User avatar
jscher2000
Posts: 11771
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA
Contact:

Re: Firefox 3 - XLST - Fails if local stylesheet has .. in path

Post by jscher2000 »

tripecac
Posts: 5
Joined: August 1st, 2006, 11:25 am

Re: Firefox 3 - XLST - Fails if local stylesheet has .. in path

Post by tripecac »

Thank you so much!!!

Here's the solution:

1) type about:config in the address bar
2) change security.fileuri.strict_origin_policy to false

This worked for me (so far).
Post Reply