Page 1 of 1

Using xpath_eval in External Tool

Posted: Thu Apr 04, 2019 2:09 pm
by michaelmh
Hi all,

I want to make a call to an external tool OS independent, and because it is either a BAT or a SH file, I thought of using $xpath_eval() to check out os.name for differentiation. I tested the behavior inside the $ask editor variable.

After some testing, I think that "if … then … else …" is not supported in the XPath expression.

This works, i.e. the default value is filled:

[Codebox=]${ask(
'${system(os.name)}',
generic,
'${xpath_eval(
upper-case('${system(os.name)}')
)}'
)}[/Codebox]

This does not work, i.e. the default value is empty but should be the same:

[Codebox=]${ask(
'${system(os.name)}',
generic,
'${xpath_eval(
if true() then upper-case('${system(os.name)}') else 'NOPE'
)}'
)}[/Codebox]

What have I got wrong?

Re: Using xpath_eval in External Tool

Posted: Fri Apr 05, 2019 11:14 am
by alex_jitianu
Hello,

There's a syntax error inside the XPath expression. The "if" condition must be between parentheses, like this:

Code: Select all

if (true()) then upper-case('${system(os.name)}') else 'NOPE'
I see that we log these a warning inside the console when there are exceptions with the XPath expression. Perhaps we should present that error directly inside the interface so that you understand what's wrong...

Best regards,
Alex

Re: Using xpath_eval in External Tool

Posted: Mon Apr 08, 2019 10:03 am
by michaelmh
Thanks,

Better reporting of such errors would indeed be welcome. I was looking for the Java Console (on Mac OS) but could not find it, or is this only accessible to developers?

- Michael

Re: Using xpath_eval in External Tool

Posted: Mon Apr 08, 2019 12:30 pm
by adrian
Hi,

If you start the .app launcher, the output of the console is redirected to the output.log and the errors to the error.log files kept in the Oxygen folder.
If you start the application via the .sh script in a Terminal, you will see the logged messages directly in the Terminal window.

Regards,
Adrian