Does XSLT doc-available(string) not work for absolute paths?
I'm using XSLT 2 (Saxon 9.x) with Java 开发者_如何学运维and having the following problem ...
doc-available('file:///C:/Users/filename.xml')
returns false
However ...
unparsed-text-available('file:///C:/Users/filename.xml')
returns true
The file is a well-formed XML and exists.
If I use relative paths, then both functions return true
.
Also tried file:/C:/Users/filename.xml
but with the same problem.
I have also removed the Windows firewall, but that has no effect.
The same code works in Oxygen.
doc-available() can return false for two reasons: the file doesn't exist, or it can't be parsed as well-formed XML. You've eliminated the first possibility using unparsed-text; that leaves the second. I can't see any reason why a relative URI should work and not an absolute URI. (Well, actually I can, like the relative URI is actually fetching the file from a different location than the absolute URI.)
Essentially there are so many variables affecting the outcome that it's very hard to tell you what the cause is in your particular case.
精彩评论