Wednesday, February 24, 2010

Inline If Else Statment


This week I had come across an issue where I had a situation in the template to put 2 inline if statements one after the other.


 

Some statement if@inline:1=2 Result 1 end if if@inline:1=1 Result 1 end if


 

But in the output it printed both results of if statements. I do not know the reason for this. So as usual went for google and landed in our guru Tim Dexter's Dec 2007 post.


 

He had explained this xdoxslt:ifelse(boolean expression ,true result, false result)


 

Example,

xdoxslt:ifelse(.//WM_FLAG='C','Canceled','Approved')


 

This xdoxslt command is looking exactly like a SQL Decode statement with only one level ;) and it's a inline statement, that the sexy thing about this statement. Thanks Tim.