title: How to get element type in xpath?
body: <p>My xml is:</p>
  
  <pre><code>&lt;record&gt;
    &lt;field name="f1"/&gt;
    &lt;id name="f2"/&gt;
    &lt;id name="f3"/&gt;
    &lt;field name="f4"/&gt;
    &lt;info/&gt;
  &lt;/record&gt;
  </code></pre>
  
  <p>I want to loop through it in xquery like this:</p>
  
  <pre><code>for $i in $records/record/field | $records/record/id
  return
     if ( .... $i is id .... ) then .... do something .... else ... do something else ...
  </code></pre>
  
  <p>Is this possible? How can distinguish when <code>$i</code> is id and when it is field?</p>