To learn more about conditional expressions based on the if, then, and else keywords, see the following URL:
http://www.w3.org/TR/2002/WD-xquery-20020816/#id-conditionals