Using xpath_eval in External Tool

Oxygen general issues.
michaelmh
Posts: 14
Joined: Tue Jan 19, 2016 5:55 pm

Using xpath_eval in External Tool

Post 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?
alex_jitianu
Posts: 1008
Joined: Wed Nov 16, 2005 11:11 am

Re: Using xpath_eval in External Tool

Post 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
michaelmh
Posts: 14
Joined: Tue Jan 19, 2016 5:55 pm

Re: Using xpath_eval in External Tool

Post 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
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Using xpath_eval in External Tool

Post 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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply