0
I want to do something like:
for $var in $myValueOfVar
return
if ($var= "X") then
<tagA>A</tagA>
<tagB>B</tagB>
<tagC>C</tagC>
else
<tagD>D</tagD>
}
But I get the following mistake:
Invalid Expression, expecting ELSE, found '>'
So I tried using 4 if
's, one for each tag, as below:
for $var in $myValueOfVar
return
if ($var= "X") then
<tagA>A</tagA>
else
()
if ($var= "X") then
<tagB>B</tagB>
else
()
if ($var= "X") then
<tagC>C</tagC>
else
()
if ($var != "X") then
<tagD>D</tagD>
else
()
}
But I get the following error:
Invalid Expression: Unexpected token: if
What is the right way to do this? I haven’t found any example following this line.