title: Return string where no node exists Xpath
body: <p>I have some XML that looks like this:</p>
  
  <pre><code>&lt;contacts&gt;
      &lt;person&gt;
          &lt;name&gt;Bob&lt;/name&gt;
          &lt;phoneNumber&gt;1234&lt;/phoneNumber&gt;
          &lt;mobileNumber&gt;5678&lt;/mobileNumber&gt;
          &lt;address&gt;Address 1&lt;/address&gt;
      &lt;/person&gt;
      &lt;person&gt;
          &lt;name&gt;Sue&lt;/name&gt;
          &lt;phoneNumber&gt;4321&lt;/phoneNumber&gt;
          &lt;address&gt;Address 2&lt;/address&gt;
      &lt;/person&gt;
  &lt;/contacts&gt;
  </code></pre>
  
  <p>And some Xpath that queries for all the child nodes of <code>&lt;person&gt;</code>:</p>
  
  <pre><code>//name | //phoneNumber | //mobileNumber | //address
  </code></pre>
  
  <p>The result is this:</p>
  
  <pre><code>Bob
  1234
  5678
  Address 1
  Sue
  4321
  Address 2
  </code></pre>
  
  <p>I would like the Xpath query to return something (a string?) so that I can identify which <code>&lt;person&gt;</code> is missing a child node (in this case the second person has no <code>&lt;mobileNumber&gt;</code>.</p>
  
  <p>The output I would like would look something like this:</p>
  
  <pre><code>Bob
  1234
  5678
  Address 1
  Sue
  4321
  null
  Address 2
  </code></pre>
  
  <p>Thanks and let me know if you need more details!</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>The expression must be valid for Xpath 1.0 as I am using javascript's <code>document.evaluate</code>.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I have got some of the way with this expression:</p>
  
  <pre><code>concat(substring(/contacts/person/mobileNumber, 1 div boolean(/contacts/person/mobileNumber)),substring('null', 1 div not(/contacts/person/mobileNumber)))
  </code></pre>
  
  <p>However it now only evaluates the first <code>&lt;person&gt;</code> and returns nothing for the second. Any suggestions?</p>