title: Is there an "if -then - else " statement in XPath?
body: <p>It seems with all the rich amount of function in xpath that you could do an "if" . However , my engine keeps insisting "there is no such function" , and I hardly find any documentation on the web (I found some dubious sources , but the syntax they had didn't work) </p>
  
  <p>I need to remove ':' from the end of a string (if exist), so I wanted to do this:</p>
  
  <pre><code>if (fn:ends-with(//div [@id='head']/text(),': '))
              then (fn:substring-before(//div [@id='head']/text(),': ') )
              else (//div [@id='head']/text())
  </code></pre>
  
  <p>Any advice? </p>