Using doc function in an xpath_eval "variable"

<oXygen/> general issues.
kirkilj
Posts: 103
Joined: Fri May 14, 2010 12:14 am

Using doc function in an xpath_eval "variable"

Post by kirkilj » Tue Mar 10, 2020 8:13 pm

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.

alex_jitianu
Posts: 771
Joined: Wed Nov 16, 2005 11:11 am

Re: Using doc function in an xpath_eval "variable"

Post by alex_jitianu » Thu Mar 12, 2020 3:55 pm

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

Post Reply