Click to See Complete Forum and Search --> : XML/XSLT Transformation Relative Path


akkad
05-12-2009, 06:02 AM
i have the following directory structure:
WebsiteDir
-----XmlDir
----------SomeXmlFile.xml
-----XslDir
----------SomeXslFile.xsl

now i perform the transformation by adding this line to the SomeXmlFile.xml :
<?xml-stylesheet type="text/xsl" href="../XslDir/SomeXslFile.xsl"?>

the href relative path is working perfectly on opera, safari, ie6/7, firefox2 and chrome, but with firefox 3 it does not work, so is there a workaround for this by keeping the same structure ?

dmboyd
05-12-2009, 08:32 AM
It should work... Does Firefox 3 give you an error page at all? Does the Error Console say anything?

akkad
05-12-2009, 10:04 AM
It should work... Does Firefox 3 give you an error page at all? Does the Error Console say anything?

no errors, but FF3 renders the xml text nodes (not the element nodes), this used to happen with me when ever the xsl path is wrong, this is the first time i have something thats is running on all browsers but not with FF !! i used to have many situations that are compatible with all but the IE.

dmboyd
05-12-2009, 10:21 AM
Wow. After a bit of research, I found this:
Recently, though, I found that this didn't work with Firefox 3.0. The stylesheet was ignored, and the error console told me that there was a "Security Error: Content at file:///c:/my/path/filename.xml may not load data from file:///c:/some/path/stylesheet.xsl".
-- http://www.snee.com/bobdc.blog/2008/09/using-xslt-to-deliver-xml-on-b.html

The solution:
Go to the URL bar and navigate to "about:config"
Change the preference security.fileuri.strict_origin_policy (http://kb.mozillazine.org/Security.fileuri.strict_origin_policy) to False

Warning: It turns off one of the security features built into Firefox 3. See the official page for the security.fileuri.strict_origin_policy (http://kb.mozillazine.org/Security.fileuri.strict_origin_policy) preference for more details.

Edit: I mentioned the Error Console in my previous post, and the quote above also mentions it. If you go to the Tools menu, you should find the Error Console there. That is a great help sometimes!