M1 Tip #6: Jelly and Numbers

Adding two numbers in Jelly is straightforward:
<j:set var="result" value="\$\{value1 + value2\}"/>
Remember that expression between curly braces is akin to a Java expression and thus value1 and value2 must be numbers. For example if you're using an XPath expression to get a value from an XML file you should use the number() function to tranform it into a number.

The same considerations apply for less than (lt) or greater than (gt) operators. For example:

<j:if test="\$\{value1 gt value2\}">

All that said if you find the need to perform a few mathematical operations, I'd recommend writing them in a Java class and then call this class from Jelly using either the <useBean> or the <invokeStatic> Jelly tags. It is always a good practice to have as much code in Java anyway and it'll help you when you migrate later on from Maven 1 to Maven 2.