Conditional logic for code template

Oxygen general issues.
charlesh
Posts: 7
Joined: Fri Jan 02, 2015 1:09 pm

Conditional logic for code template

Post by charlesh »

I've created a code template for use when authoring content. It does a nice job of prompting the user for a value, which is then wrapped in a specific element (which has a specific attribute).

I'd like to extend this so that the value of ${selection} is evaluated, and if this is not empty then we simply wrap the current selection. Only if there is no selection would we prompt the user for a value.

Can this be done? I'm using oXygen 17.1

Current Code:

Code: Select all

<keyword otherprops="g.signal.name">${ask('Please provide the signal name.')}</keyword>
Desired (pseudocode):

Code: Select all


if ($selection=="") {
<keyword otherprops="g.signal.name">${ask('Please provide the signal name.')}</keyword>
} else {
<keyword otherprops="g.signal.name">${selection}</keyword>
}
charlesh
Posts: 7
Joined: Fri Jan 02, 2015 1:09 pm

Re: Conditional logic for code template

Post by charlesh »

Sorry, that should be v17.0.

Thanks.
Radu
Posts: 9051
Joined: Fri Jul 09, 2004 5:18 pm

Re: Conditional logic for code template

Post by Radu »

Hi Charles,

Sorry but we do not have such possibilities of evaluating conditions when using code templates.
If you are editing in the Author visual editing mode you should consider creating Author actions which can call operations, either implemented in Java or Javascript-based:

https://www.oxygenxml.com/doc/versions/ ... tions.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply