I just ran into this issue myself, I know this was posted 10 years ago but it still apparently is an issue so I hope this helps anyone else that comes across this thread.
You can't use == because its not comparing strings correctly, so your immediate thought should be to use the following (note this will may still NOT work)
<if test="irregularity.equals('B')">
</if>
The above will only work if the variable "irregularity" was defined as a char. If it is defined as a string, this will still not work. This is caused by the Single quotes around the 'B', which in the xml will read as a character and the conditional will then be comparing a string to a character and will not yield a correct result (although it doesn't throw an error).
Instead, you need to flip the quotes around, single quotes on the outside and double quotes on the inside. This will compare a string and string.
<if test = 'irregularity.equals("B")'>
</if>
Now as long as irregularity is a string you should yield a correct result.