开发者

XSLT stylesheet relative path problem under windows

I have a stylesheet located at /template.xsl and an xml file located at /en/index.xml, where "/" (the root) is actually of the form "C:\stuff\otherstuff\".

The xml file contains <?xml-stylesheet type="text/xsl" href="../template.xsl"?>, but the stylesheet isn't detected. I've tried countless variation, using backslashes or pair or backslashes instead of slashes, using file:///, absolute path, ...

What is wrong ?

Edit : for the record, it does work in IE but not in Firefox.

Edit : and here is the explanation : http://forums.mozillazine.org/viewtopic.php?f=25&t=670995 开发者_如何学编程This also include the solution :

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


I noticed that if your put template.xsl in a subdirectory say DISPLAY, href="DISPLAY/template.xsl" does work. But if you put your XML in another subdirectory, say A, href="../DISPLAY/template.xsl" doesn't work.

It seems that there is a problem with "..".

(Even in 2015, when using Firefox 40.0 !) See Nicholas Smethurst's attachment in : https://bugzilla.mozilla.org/show_bug.cgi?id=439924

--> as said above, switch security.fileuri.strict_origin_policy


There are two things that might be the problem I think.
1. You say the files are placed in the same folder, href="../template.xsl" directs to the parent folder of your XML file. Perhaps you should use href="template.xsl".
2. Firefox is a Beta version. If you are testing things out you should always use a stable version because otherwise it could be Beta software causing the bugs.


If the stylesheet is called template.xml, as you say, then a reference to template.xsl isn't going to find it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜