I am looking to modify (or use a different function) the below xdoxslt
code to allow for multiple values for the If
so that if A.DESCR1
is equal to either 'General Hospital' or 'Main Hospital' then output 'two', otherwise (else) output 'one'. I need this to work with inline text as below.
<?xdoxslt:ifelse(A.DESCR1 = 'General Hospital', 'two', 'one')?>
While your solution works, I'd like to point out that you can just put the or
statement in the ifelse condition.
ifelse syntax: <?xdoxslt:ifelse(condition,true,false)?>
with condition
being A.DESCR1='General Hospital' or A.DESCR1='Main Hospital'
<?xdoxslt:ifelse(A.DESCR1='General Hospital' or A.DESCR1='Main Hospital', 'two', 'one')?>
You can even nest an ifelse
function in another ifelse
function:
Nested ifelse syntax: <?xdoxslt:ifelse(condition1,true1,xdoxslt:ifelse(condition2,true2,false))?>
<?xdoxslt:ifelse(A.DESCR1='General Hospital', 'two', xdoxslt:ifelse(A.DESCR1='Main Hospital', 'two', 'one'))?>