title: XPath to return default value if node not present
body: <p>Say I have a pair of XML documents</p>
  
  <pre><code>&lt;Foo&gt;
      &lt;Bar/&gt;
      &lt;Baz&gt;mystring&lt;/Baz&gt;
  &lt;/Foo&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&lt;Foo&gt;
      &lt;Bar/&gt;
  &lt;/Foo&gt;
  </code></pre>
  
  <p>I want an XPath (Version 1.0 only) that returns "mystring" for the first document and "not-found" for the second. I tried </p>
  
  <pre><code>(string('not-found') | //Baz)[last()]
  </code></pre>
  
  <p>but the left hand side of the union isn't a node-set</p>