开发者

XSL document() file not found

开发者 https://www.devze.com 2022-12-19 17:34 出处:网络
I have xsl file while processing xml file some time开发者_Python百科 I do need several xml file to be include, for that I use document() method, my problem is that all time all xml file which I includ

I have xsl file while processing xml file some time开发者_Python百科 I do need several xml file to be include, for that I use document() method, my problem is that all time all xml file which I include are not available online hence my transformation is stop due to file not found!!! does any body help me the best practice for this scenario.


The problem is that the XSLT spec leaves it up to the implementation to define how to handle the case when a file referenced by the document() function is unavailable. There is a good discussion of this here: http://www.biglist.com/lists/xsl-list/archives/200801/msg00036.html

If you have the option to use XSLT 2.0 you can use the doc-available() function to test whether a file is available before calling the document() function.


Create a local Hosts File entry for the website(s) that point to your local machine(or dev server).

An example that points www.foo.com and www.bar.com to the local machine:

127.0.0.1       localhost
127.0.0.1   www.foo.com
127.0.0.1   www.bar.com

Place sample XML file(s) on your local webserver(in necessary folder structure), so that when testing locally any requests for the files on the remote servers(e.g. http://www.foo.com/file1.html, http://www.bar.com/file2.html) will go to your locally hosted files.

0

精彩评论

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

关注公众号