X-Application Version: 4.1.1
Tamino Version : 4.1.4.1,
Platform : WinXP
WebContainer : Tomcat 4.1.17
JDK Version : 1.4.1
I am trying to use a variable in an xapp:if statement:
<xapp:if condition=“equal” value=“${passwordin$}” select=“/User/Password”>
Passwords are equal</>
</xapp:if>
The value being compared is ${passwordin$} and not the contents of passwordin. I only get the “Passwords are equal” when /User/Password contains ${passwordin$}.
I have tried all sorts of other variations without success. Is there any way I can do the comparison against a variable?
Thanks Priscilla
Hello,
I checked the code as well as the source code of X-Application. The result is that for the attribute ‘value’ the variable resolving mechanism is not invoked. This is not a bug. The intention when we introduced the variables handling to provide this feature only within the query context (=> xapp:action and xapp:directcommand tag).
However, the plugin mechanism of X-Application should allow you to modify the behavior. I send you two code snippets:
(1) For the file xapplication.xml to define the plug-ins ‘equal’ and ‘notequal’
(2) For a Java class you can compile into the WEB-INF/classes directory of your application (perhaps you should use another package name and class name).
After this, the attribute ‘value’ should be resolved.
Bye
Christian.
xapplication.xml:
<xapplication>
...
<plugins>
...
<node>
<action name="equal"
method=" myapplication.mysubpackage.mysubsubpackage.MyNodePlugin.equal">
<arg>arg</arg>
<arg>variables</arg>
</action>
<action name="notequal"
method=" myapplication.mysubpackage.mysubsubpackage.MyNodePlugin.notEqual">
<arg>arg</arg>
<arg>variables</arg>
</action>
...
</node>
</pre><BR><BR><B>Java class implementing the plug-ins</B><BR><pre class="ip-ubbcode-code-pre">
package myapplication.mysubpackage.mysubsubpackage;
import com.softwareag.xtools.xapplication.plugin.StandardNodePlugin;
import com.softwareag.xtools.xapplication.plugin.VariablesHandler;
public class MyNodePlugin {
public static String equal(BusinessDocument doc, Object node, String refValue, VariablesHandler vh) throws XException {
refValue = vh.evaluatingReplace(refValue);
return StandardNodePlugin.equal(doc, node, refValue);
}
public static String notEqual(BusinessDocument doc, Object node, String refValue, VariablesHandler vh) throws XException {
refValue = vh.evaluatingReplace(refValue);
return StandardNodePlugin.notEqual(doc, node, refValue);
}
}