Page 1 of 1

Using doc function in an xpath_eval "variable"

Posted: Tue Mar 10, 2020 8:13 pm
by kirkilj
I created an external tool that presents a pull-down menu of all targets in an ant build.xml file for execution. I set the working directory to ${pd}.

Code: Select all

cmd /C mvn compile -Dt=${ask('Choose a target:', combobox,( ${xpath_eval(string-join(fn:for-each (doc('build.xml')/project/target/@name, function($target) {concat("'",$target,"'",':',"'",$target,"'") } ) , ';' ) )} ), 'main')}
This works well if the build.xml is the current file in the editor, but fails if any other file is current with:
An error occurred while expanding the possible values of the 'ask' editor variable, at line 0, column 0. Please check the syntax of the possible values: ''.
I was hoping the doc function was using the Working Directory of the external tool as the baseURI. I also tried doc('${pd}/build.xml'), but the project directory variable is not being resolved.

Re: Using doc function in an xpath_eval "variable"

Posted: Thu Mar 12, 2020 3:55 pm
by alex_jitianu
Hi,
I was hoping the doc function was using the Working Directory of the external tool as the baseURI.
In my tests it didn't really matter if the build.xml file was opened or not in an editor. The relative paths are expanded to the oxygen installation directory. Luckily, the workaround is to use ${pdu} inside the doc() function. The doc() function expects an URL so ${pd}, which is a directory path, doesn't work.


Best regards,
Alex