I'm using saxon to create 5 html files from 1 xml file. Whenever I run the code windows, it runs smoothly and creates all the necessary files. However, when I run the code in unix, it resulted in this error:
Failed to create output file file:/output1.html: Permission denied
Searching in stackoverflow, I learned it was trying to write into the root directory, which brought me to try setBaseOutputURI().
I'm trying to make saxon output the html files into /foo/biz/html_out, so I wrote this code:
String filePathUri = "file://foo/biz/html_out/";
xsltTransformer.setBaseOutputURI(filePathUri);
The error now reads
net.sf.saxon.s9api.SaxonApiException: Cannot write to URI file://foo/output1.html (URI has an authority component)
at net.sf.saxon.s9api.XsltTransformer.transform(XsltTransformer.java:454)
My questions are:
Did I arrive at the correct conclusion that I have to use setBaseOutputURI?
Am I writing the URI wrong?
Is there any else I should try, considering the code works fine in windows?
Found the answer!
I had to use "file:///foo/biz/html_out" as the URI. The extra slash made the rest of the string the text the path.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With