I am trying to run Saxon HE from java, using code that can be found in Saxon resources. I have tried changing it so that it doesn't create an aditional file from the java code, but instead having the xslt file doing that throught the use of "result-document".My xslt did work as intended in Altova XMLSpy, but I wanted to see if I could get Saxon doing the same thing - no luck there, save from a massive head ache and loads of frustration and lots of wishes that Python will get support for this some day soon...I get the following error message: The system identifier of the principal output file is unknown.When I google it, I find an answer that the base uri can't be found, but nowhere can be seen how to set the base uri... So my firt question is: Where is the base uri set? Is it in the java class or in the xslt file? I cannot see where I would set this in the xslt file, so my guess is that I would have to set this as a property of the compiler/transformer?ANother question is about the actual href attribute of the result-document. If I want to point to a relative path, what is the syntax, and maybe what would an example look like?And what about absolute paths?In my file that is working in Altova, I somehow get the base uri for the source xml file that is to be transformed, and then I direct the output to a relative directory. In Saxon, the base uri instead seems to get the location of the xslt file... No idea why this is the case.When setting an absolute path, I get an error stating I'm using an unknown protocol. So I entered "file:///" before the path. Now I get a warning complaining about a document not beeing available at a path that is concatenated of the xslt file path, and a lookup path I'm using during the transform.As you can see, I'm all over the place here, so some guide lines and help would be greatly appreciated.
Can you please show your code?
Thank you for your input on this. I am using the s9api API, and most of the code I'm using is from one of the examples I've found in the Saxon resources. Without that I'd even more lost, so thank you for those examples as well. I re-wrote my java code so that I wrote my transformations to a string, and from there to a document. The reason for this is that I found it easier to extract a complicated DOCTYPE that is supposed to go into the result unchanged easier to do with a regex, and then concatenationg my results. I did try the setOutputURI and that resolved some issues.
To make it work, I set the output to an absolute path.