title: xquery beginner- how to use an if-then-else within a FLWOR statement
body: <p>I want to extract some content from a web page's XML equivalent, using XQuery.</p>
  
  <p>Here, I want to use if-then-else -- if a specific condition is met, then one value is returned by the xquery expression, otherwise a different value is returned.</p>
  
  <p>This is the expression I have with me--</p>
  
  <p>I am working to extract some content from a web page.</p>
  
  <p>Given below is the Xquery code I am using-- I am using a XQuery library to parse through XML which is obtained by transforming a HTML web page into XML...after that I am extracting some specific content from that XML page...</p>
  
  <pre><code>                    declare variable $doc as node() external;
  
                      let $select_block := $doc//div[@class="randomclass" and contains(.,'MatchingText')]
                      for $select_link in $select_block/a 
                      for $select_link_url in $select_link/@href
                          where  contains($assignee_link_url,'inassignee')  
                       return data($select_link)
  </code></pre>
  
  <p>Now how do I use if-then-else within this expression?</p>
  
  <p>I tried to add an if-then immediately after 'return' keyword but I am getting error...
  Basically, if some content is found for $select_block above, then data($select_link) should be returned, otherwise the static text 'Missing Value' should be returned.</p>
  
  <p>What is the correct way of using if-then-else with the above xquery expression?</p>