Page 1 of 1

Xsltproc custom compilation

Posted: Thu Jan 28, 2016 9:47 pm
by emilise
Hi

I am using Oxygen 13.2 under Windows 8 64bits.
This version of Oxygen is bundled with xsltproc using libxml 1.1.26. I need to use libxml 1.1.28. I have found binaries for xsltproc using this version, installed them on my machine, it works.
When I replace Oxygen dll with he new ones, I get
I/O error : Invalid argument
The transformer process ended with code: 11

which is documented as "could not write the result to the output file"
I have tried multiple things for configuring the output file in scenario description, including no output file, and could not find anything that works. I have used xsltproc in command line with and without output file and it works fine.
So my question : is how can we see the command line used by Oxygen, or even better, customize it, so see/fix what is wrong ?

Since this was not working, I have tried creating a custom XSLT processor with my working command line : if I don't specify any output file in the command line, I get the transformation result as warnings instead of the editor view. If I specify the output file, I get same error as built-in xsltproc :
I/O error : Invalid argument
The transformer process ended with code: 11

I suspect there is some access right issue, I have tried executing Oxygen as administrator but not better...

Any ideas ??

Thanks for your help!

Re: Xsltproc custom compilation

Posted: Mon Feb 01, 2016 12:03 pm
by adrian
Hi,

I believe you are referring to libxslt 1.1.28. libxml is at a different version. Anyway, I found it here (for Windows) with all required libraries:
http://xmlsoft.org/sources/win32/64bit/
I downloaded most libraries for x86, put them all in the same folder and it works as you described.
So my question : is how can we see the command line used by Oxygen, or even better, customize it, so see/fix what is wrong ?
I'm afraid you can't see the command line. But that doesn't seem to be the problem anyway. Oxygen simply provides absolute file paths for xsl , xml and output files. As soon as you specify an output file with an absolute path, this build of xsltproc fails. I can reproduce this problem independently from Oxygen.
e.g.

Code: Select all

xsltproc.exe -o "C:\path\to\out.xml" my.xsl my.xml
I/O error : Invalid argument
However, if I use a forward slash (as in Unix paths) in the output path, it works:

Code: Select all

xsltproc.exe -o "C:/path/to/out.xml" my.xsl my.xml
So it seems to be a problem with this build of xsltproc, at least on Windows, as it expects absolute paths of the output to have forward slashes(/).

The simplest solution right now is to create a custom XSLT engine in Options > Preferences, XML > XSLT-FO-XQuery > Custom Engines and use the command line:

Code: Select all

xsltproc.exe -o fixedOutput.xml "${xsl}" "${xml}"
Unfortunately you need to use a fixed output file and be careful that the "Working directory" is set to a location with write access (that's where the output file will be saved). Try ${cfd} (same as the input file directory).

Regards,
Adrian

Re: Xsltproc custom compilation

Posted: Tue Feb 02, 2016 3:45 pm
by emilise
Hi

Thanks for your investigations that made me realize that even if I enter slashes in Oxygen "output file" setting, it gets converted as backslashes, which is why I thought that never slashes nor backslashes worked in Oxygen.

It works like you say, so it's kind of good, but actually what I really wanted to do what to display the result at the bottom of oxygen thanks to "display as" : "XML" setting. Until now I was not saving output anywhere but only displaying it.

If I use built-in xsltproc and leave output file blank but request to display output, I get the "I/O error : Invalid argument" error. I guess that Oxygen requests that the output is written to a temporary file so that I can be displayed ?
If I do the same with a custom xsltproc without specifying any "-o" argument, the output gets displayed as warnings, not as the actual result.
Is there a way to use the "display as" : "XML" setting with a custom xsltproc ?

Thanks again for your helpful comment!

Re: Xsltproc custom compilation

Posted: Tue Feb 02, 2016 3:59 pm
by adrian
Hi,
Is there a way to use the "display as" : "XML" setting with a custom xsltproc ?
Yes. You have to configure the Output > Save As file from the transformation scenario to indicate the fixed output file of the custom xsltproc. This tells Oxygen where to find the output file. Then you can use the "Show As: XML".

Regards,
Adrian

Re: Xsltproc custom compilation

Posted: Fri Feb 05, 2016 12:22 pm
by emilise
Hi

Ok thanks for all input. Here is my final solution if anyone ever wants to do the same :

[*] Define a fixed output file for XSLT scenario
[*] Define custom xsltproc with command :

Code: Select all

${oxygenInstallDir}/xsltproc.bat -o "${out}" "${xsl}" "${xml}"
[*]Create ${oxygenInstallDir}/xsltproc.bat file with content :

Code: Select all

@ECHO OFF
SET output=%2
SET fixedOutput=%output:\=/%

set xml=%3
set fixedXml=%xml:\=/%

set xsl=%4
set fixedXsl=%xsl:\=/%

SET command="%~dp0/xsltproc.exe" %1 %fixedOutput% %fixedXml% %fixedXsl%

%command%
[*]Edit [userdir]\AppData\Roaming\com.oxygenxml\oxyOptionsSa13.2.xml to batch modify xsltTransformer and outputFile for all my XSLT scenario

And finally I get output from this custom xsltproc directly in oxygen! Nice :D
Thanks again for the help!!!