CSL Choose If - Test for multiple conditions with one negation

I would like to test for multiple conditions where one condition should NOT occur.

For example I would like to test if the variable "issue" is text, i.e. non-numeric.

That means it should exist (variable="issue") and it should be NOT numeric (is-numeric="issue" match="none").

As far as I understand CSL currently does not allow for such a test in a single if-statement because you have to mix a positive test with a negation.

You can stack tests like this:
<choose>
<if variable="issue">
<choose>
<if is-numeric="issue" match="none">


But then you have to repeat the stacked test in the <else> block.
  • it's mainly a syntax problem. There've been proposals to that end before, but the've met with some skepticism because they would introduce completely unknow syntax (which creates a significant additional burden on implementation for the various processors that exist for CSL).

    That said, in your example it is pretty likely that you don't actually have to test for the presence of the variable: remember that variables that don't exist are simply not printed and you can use groups to make sure that any terms/labels you have for them aren't printed either when you use them. (To be more specific I'd need the full example).

This is an old discussion that has not been active in a long time. Before commenting here, you should strongly consider starting a new discussion instead. If you think the content of this discussion is still relevant, you can link to it from your new discussion.

Sign In or Register to comment.