title: how to use if else in xquery assignment
body: <p>I am trying to use a if condition to assign a value to a variable in an xquery. I am not sure how to do this.</p>
  
  <p>This is what I tried:</p>
  
  <pre><code>declare namespace libx='http://libx.org/xml/libx2';
  declare namespace atom='http://www.w3.org/2005/Atom';
  declare variable $entry_type as xs:string external;
  let $libx_node :=
      if ($entry_type = 'package' or 'libapp') then
        {element {fn:concat("libx:", $entry_type)} {()} }
      else if ($entry_type = 'module') then
        '&lt;libx:module&gt;
          &lt;libx:body&gt;{$module_body}&lt;/libx:body&gt;
        &lt;/libx:module&gt;'
  </code></pre>
  
  <p>This code throws an [XPST0003] Incomplete 'if' expression error. Can someone help me fix this?</p>
  
  <p>Also, can someone suggest some good tutorials to learn xqueries.</p>
  
  <p>Thanks,
  Sony</p>